added employer column in ready table
This commit was merged in pull request #31.
This commit is contained in:
@@ -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 };
|
||||
Reference in New Issue
Block a user