This commit is contained in:
@@ -24,6 +24,7 @@ import type { Product, ProductCreate, ProductEditPayload } from "./resources/pro
|
||||
import type { Contract, ContractCreate } from "./resources/contracts";
|
||||
import { notifications } from "@mantine/notifications";
|
||||
import { t } from "@/config/i18n";
|
||||
import type { DeleteDependencies, EntityName } from "./resources/common";
|
||||
|
||||
export async function refreshToken() {
|
||||
return await fetch(`${Config.backend_uri}/auth/refresh`, {method: "POST", credentials: "include"});
|
||||
@@ -321,6 +322,25 @@ export function useGetForm(
|
||||
});
|
||||
}
|
||||
|
||||
export function useGetDeleteDependencies(
|
||||
entity: EntityName,
|
||||
id?: number,
|
||||
) {
|
||||
return useQuery<DeleteDependencies[]>({
|
||||
queryKey: [`${entity}_delete_preview`],
|
||||
queryFn: () =>
|
||||
fetchWithAuth(`${Config.backend_uri}/${entity}s/${id}/preview-delete`, {
|
||||
credentials: "include",
|
||||
}).then((res) => {
|
||||
const result = res.json()
|
||||
console.log(result)
|
||||
return result
|
||||
}),
|
||||
enabled: !!id,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function useGetForms(filters?: URLSearchParams): UseQueryResult<Form[], Error> {
|
||||
const queryString = filters?.toString();
|
||||
return useQuery<Form[]>({
|
||||
|
||||
Reference in New Issue
Block a user