infodusha
infodusha
TtRPC
Created by infodusha on 5/28/2024 in #❓-help
Make meta in react-query type-safe.
So right now I have to write something like
*.useQuery({}, {
meta: {
mfa: false
} satisfies ReactQueryMeta
});
*.useQuery({}, {
meta: {
mfa: false
} satisfies ReactQueryMeta
});
Is there a way to force all the queries to have this meta typed with my type?
2 replies
TtRPC
Created by infodusha on 2/9/2024 in #❓-help
Hot to redirect in middleware when using createCallerFactory
Hello. I do have this tiny middleware:
const authMiddleware = middleware(async (opts) => {
const result = await opts.next();
if (!result.ok) {
if (result.error.status === ErrorCode.TOKEN_INVALID) {
redirect('/logout');
}
}
return result;
});
const authMiddleware = middleware(async (opts) => {
const result = await opts.next();
if (!result.ok) {
if (result.error.status === ErrorCode.TOKEN_INVALID) {
redirect('/logout');
}
}
return result;
});
I am aware of redirect throws an error but it seems to be wrapped in a result.error.cause when thrown out so next can't realize that is redirect error and just ouputs Error: NEXT_REDIRECT to console. isRedirectError(result.error) === false while isRedirectError(result.error.cause) === true Is there any known workaround for this to work? Node 20 / npm 10
13 replies