infra: add linting and formatting for js projects (#230)
* wip * wip * wip * format * wip(mobile): lint and format * cleanup * nits * nits * idiomatic react * nit * format all root files
This commit was merged in pull request #230.
This commit is contained in:
@@ -1,13 +1,9 @@
|
||||
import {
|
||||
MutationCache,
|
||||
QueryCache,
|
||||
QueryClient,
|
||||
} from "@tanstack/react-query";
|
||||
import { toast } from "sonner-native";
|
||||
import { ApiError, logError, reportError, toUserMessage } from "@/lib/errors";
|
||||
import { useAuthStore } from "@/stores/auth-store";
|
||||
import { MutationCache, QueryCache, QueryClient } from '@tanstack/react-query';
|
||||
import { toast } from 'sonner-native';
|
||||
import { ApiError, logError, reportError, toUserMessage } from '@/lib/errors';
|
||||
import { useAuthStore } from '@/stores/auth-store';
|
||||
|
||||
declare module "@tanstack/react-query" {
|
||||
declare module '@tanstack/react-query' {
|
||||
interface Register {
|
||||
queryMeta: { toastOnError?: boolean };
|
||||
mutationMeta: { suppressToast?: boolean };
|
||||
@@ -48,7 +44,7 @@ export function createQueryClient(): QueryClient {
|
||||
queryCache: new QueryCache({
|
||||
onError: (err, query) => {
|
||||
handleUnauthorized(err);
|
||||
logError(err, { scope: "query", queryKey: query.queryKey });
|
||||
logError(err, { scope: 'query', queryKey: query.queryKey });
|
||||
if (query.meta?.toastOnError) {
|
||||
toast.error(toUserMessage(err));
|
||||
}
|
||||
@@ -58,7 +54,7 @@ export function createQueryClient(): QueryClient {
|
||||
onError: (err, _variables, _context, mutation) => {
|
||||
handleUnauthorized(err);
|
||||
reportError(err, {
|
||||
scope: "mutation",
|
||||
scope: 'mutation',
|
||||
mutationKey: mutation.options.mutationKey,
|
||||
});
|
||||
if (mutation.meta?.suppressToast) return;
|
||||
|
||||
Reference in New Issue
Block a user