Continue removing unused frontend components/logic, improve querying in select pages

This commit is contained in:
Tuan Dang
2023-08-10 12:18:17 +07:00
parent b47f61f1ad
commit 9963724a6a
44 changed files with 181 additions and 1536 deletions
@@ -8,18 +8,16 @@ const incidentContactKeys = {
getAllContact: (orgId: string) => ["org-incident-contacts", { orgId }] as const
};
const fetchOrgIncidentContacts = async (orgId: string) => {
const { data } = await apiRequest.get<{ incidentContactsOrg: IncidentContact[] }>(
`/api/v1/organization/${orgId}/incidentContactOrg`
);
return data.incidentContactsOrg;
};
export const useGetOrgIncidentContact = (orgId: string) =>
useQuery({
queryKey: incidentContactKeys.getAllContact(orgId),
queryFn: () => fetchOrgIncidentContacts(orgId),
queryFn: async () => {
const { data } = await apiRequest.get<{ incidentContactsOrg: IncidentContact[] }>(
`/api/v1/organization/${orgId}/incidentContactOrg`
);
return data.incidentContactsOrg;
},
enabled: Boolean(orgId)
});