improve: add production stage

This commit is contained in:
h z
2024-12-09 07:01:22 +00:00
parent 0e6fd8409a
commit ba69541a7b
29 changed files with 616 additions and 92 deletions

View File

@@ -1,10 +1,11 @@
import { useQuery, useMutation, useQueryClient } from "react-query";
import { fetch_ } from "./request-utils";
import config from "../config";
import {useConfig} from "../ConfigProvider";
export const usePaths = (parent_id) => {
const queryClient = useQueryClient();
const config = useConfig();
return useQuery(
["paths", parent_id],
() => fetch_(`${config.BACKEND_HOST}/api/path/parent/${parent_id}`),
@@ -24,6 +25,7 @@ export const usePaths = (parent_id) => {
export const usePath = (id) => {
const config = useConfig();
const queryClient = useQueryClient();
const cachedData = queryClient.getQueryData(["path", id]);
@@ -41,6 +43,7 @@ export const usePath = (id) => {
};
export const useCreatePath = () => {
const config = useConfig();
const queryClient = useQueryClient();
return useMutation(
@@ -58,6 +61,7 @@ export const useCreatePath = () => {
};
export const useUpdatePath = () => {
const config = useConfig();
const queryClient = useQueryClient();
return useMutation(
@@ -75,6 +79,7 @@ export const useUpdatePath = () => {
};
export const useDeletePath = () => {
const config = useConfig();
const queryClient = useQueryClient();
return useMutation(