## What does this PR do? - This PR migrates the `/auth/logout` and `/auth/signin` pages to the app directory (which runs under the App Router). - Using `/future/auth/logout` is available at all times and is supposed to log the user out as `/auth/logout` page does. - However `signin` page (or fragment) was used before should behave the same using the `/future/auth/signin` route. ## Requirement/Documentation - If there is a requirement document, please, share it here. - If there is ab UI/UX design document, please, share it here. ## Type of change - [x] Chore (refactoring code, technical debt, workflow improvements) - [x] New feature (non-breaking change which adds functionality) ## How should this be tested? - Using `/future/auth/logout` is available at all times and is supposed to log the user out as `/auth/logout` page does. - However `signin` page (or fragment) was used before should behave the same using the `/future/auth/signin` route. It was not tested locally. ## Mandatory Tasks - [x] Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.
20 lines
538 B
TypeScript
20 lines
538 B
TypeScript
import type { GetServerSidePropsContext } from "next";
|
|
|
|
import { ssrInit } from "@server/lib/ssr";
|
|
|
|
export async function getServerSideProps(context: GetServerSidePropsContext) {
|
|
const ssr = await ssrInit(context);
|
|
// Deleting old cookie manually, remove this code after all existing cookies have expired
|
|
context.res?.setHeader(
|
|
"Set-Cookie",
|
|
"next-auth.session-token=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"
|
|
);
|
|
|
|
return {
|
|
props: {
|
|
trpcState: ssr.dehydrate(),
|
|
query: context.query,
|
|
},
|
|
};
|
|
}
|