feat(auth): add loading state for user and role management (#1188)

This commit is contained in:
Rıdvan Akca
2023-08-09 22:51:07 +03:00
committed by GitHub
parent ce8c9906cb
commit 5046c4c911
10 changed files with 308 additions and 171 deletions

View File

@@ -6,7 +6,7 @@ import { GET_ROLE } from 'graphql/queries/get-role.ee';
type QueryResponse = {
getRole: IRole;
}
};
export default function useRole(roleId?: string) {
const [getRole, { data, loading }] = useLazyQuery<QueryResponse>(GET_ROLE);
@@ -15,14 +15,14 @@ export default function useRole(roleId?: string) {
if (roleId) {
getRole({
variables: {
id: roleId
}
id: roleId,
},
});
}
}, [roleId]);
return {
role: data?.getRole,
loading
loading,
};
}