improve: add production stage
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user