mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-07 11:37:26 +02:00
⬆️ v3.0.0 (#704)
This commit is contained in:
parent
735056f25f
commit
c22b3abc4d
385 changed files with 19912 additions and 5250 deletions
|
@ -69,21 +69,3 @@ export const withAuth: GetServerSideProps = async (ctx) => {
|
|||
|
||||
return { props: {} };
|
||||
};
|
||||
|
||||
/**
|
||||
* Require user to be logged in if AUTH_REQUIRED is true
|
||||
* @returns
|
||||
*/
|
||||
export const withAuthIfRequired: GetServerSideProps = async (ctx) => {
|
||||
if (process.env.AUTH_REQUIRED === "true") {
|
||||
if (!ctx.req.session.user || ctx.req.session.user.isGuest) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/login",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
return { props: {} };
|
||||
};
|
||||
|
|
|
@ -20,7 +20,9 @@ export const trpc = createTRPCNext<AppRouter>({
|
|||
queryClientConfig: {
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
networkMode: "always",
|
||||
cacheTime: Infinity,
|
||||
staleTime: 1000 * 60,
|
||||
},
|
||||
},
|
||||
mutationCache: new MutationCache({
|
||||
|
|
|
@ -8,13 +8,15 @@ export function composeGetServerSideProps(
|
|||
for (const getServerSideProps of fns) {
|
||||
const fnRes = await getServerSideProps(ctx);
|
||||
|
||||
if ("redirect" in fnRes) {
|
||||
return fnRes;
|
||||
}
|
||||
|
||||
if ("props" in fnRes) {
|
||||
res.props = {
|
||||
...res.props,
|
||||
...fnRes.props,
|
||||
};
|
||||
} else {
|
||||
return fnRes;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue