19 lines
484 B
TypeScript
19 lines
484 B
TypeScript
import { useMutation } from "@tanstack/react-query";
|
|
|
|
export function useRefreshFiles() {
|
|
return useMutation({
|
|
mutationFn: async () => {
|
|
const res = await fetch(`${import.meta.env.VITE_API_URL}/protected/refreshfiles`, {
|
|
method: "POST",
|
|
credentials: "include",
|
|
});
|
|
|
|
if (!res.ok) {
|
|
throw new Error("Invalid credentials");
|
|
}
|
|
|
|
return res.json();
|
|
},
|
|
});
|
|
}
|