mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
no errors when viewing a different course
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import { getAxiosErrorMessage } from "@/services/axiosUtils";
|
||||
import { isServer, QueryCache, QueryClient } from "@tanstack/react-query";
|
||||
import { AxiosError } from "axios";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
export function makeQueryClient() {
|
||||
return new QueryClient({
|
||||
@@ -13,6 +16,15 @@ export function makeQueryClient() {
|
||||
retry: 0,
|
||||
refetchOnMount: false,
|
||||
},
|
||||
mutations: {
|
||||
onError: (error) => {
|
||||
const message = getAxiosErrorMessage(error as AxiosError);
|
||||
console.error("Mutation error:", message);
|
||||
if (!isServer) {
|
||||
toast.error(message);
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
queryCache: new QueryCache({
|
||||
onError: (e) => console.log("error in query client", e),
|
||||
|
||||
Reference in New Issue
Block a user