added employer column in ready table

This commit was merged in pull request #31.
This commit is contained in:
victorAnumudu
2024-06-13 17:33:47 +01:00
parent c970467f16
commit ea90bd6fc5
15 changed files with 38 additions and 13 deletions
@@ -0,0 +1,42 @@
import { useQuery } from "react-query";
import { UserEditModalForm } from "./UserEditModalForm";
import { isNotEmpty, QUERIES } from "../../../../../_digifi/helpers";
import { useListView } from "../core/ListViewProvider";
import { getUserById } from "../../core/_requests";
const UserEditModalFormWrapper = () => {
const { itemIdForUpdate, setItemIdForUpdate } = useListView();
const enabledQuery: boolean = isNotEmpty(itemIdForUpdate);
const {
isLoading,
data: user,
error,
} = useQuery(
`${QUERIES.READY_LIST}-user-${itemIdForUpdate}`,
() => {
return getUserById(itemIdForUpdate);
},
{
cacheTime: 0,
enabled: enabledQuery,
onError: (err) => {
setItemIdForUpdate(undefined);
console.error(err);
},
}
);
if (!itemIdForUpdate) {
return (
<UserEditModalForm isUserLoading={isLoading} user={{ id: undefined }} />
);
}
if (!isLoading && !error && user) {
return <UserEditModalForm isUserLoading={isLoading} user={user} />;
}
return null;
};
export { UserEditModalFormWrapper };