Never cache ARCIntegration info

This commit is contained in:
zkldi
2021-11-17 18:21:20 +00:00
parent dd0d19ede9
commit 93087f0ac1
2 changed files with 7 additions and 3 deletions
@@ -16,7 +16,7 @@ export default function ARCIntegrationPage({ reqUser }: { reqUser: PublicUserDoc
const { data, isLoading, error } = useApiQuery<{
iidx: ARCSavedProfileDocument | null;
sdvx: ARCSavedProfileDocument | null;
}>(`/users/${reqUser.id}/integrations/arc`);
}>(`/users/${reqUser.id}/integrations/arc`, undefined, true);
useEffect(() => {
if (data) {
@@ -2,7 +2,11 @@ import { useQuery } from "react-query";
import { SuccessfulAPIResponse } from "tachi-common";
import { APIFetchV1, UnsuccessfulAPIFetchResponse } from "util/api";
export default function useApiQuery<T>(url: string | string[], options?: RequestInit) {
export default function useApiQuery<T>(
url: string | string[],
options?: RequestInit,
neverCache = false
) {
return useQuery<T, UnsuccessfulAPIFetchResponse>(
url,
async () => {
@@ -25,7 +29,7 @@ export default function useApiQuery<T>(url: string | string[], options?: Request
return res.body;
},
{
retry: (options?.method ?? "GET") === "GET",
retry: (options?.method ?? "GET") === "GET" && !neverCache,
}
);
}