feat(auth): add user and role management

This commit is contained in:
Ali BARIN
2023-07-18 21:00:10 +00:00
parent a7104c41a2
commit 0deaa03218
108 changed files with 2909 additions and 388 deletions

View File

@@ -0,0 +1,28 @@
import * as React from 'react';
import { useLazyQuery } from '@apollo/client';
import { IRole } from '@automatisch/types';
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);
React.useEffect(() => {
if (roleId) {
getRole({
variables: {
id: roleId
}
});
}
}, [roleId]);
return {
role: data?.getRole,
loading
};
}