From a658eaea3812ff5f1f2b6f3c0a90b4821c455e8b Mon Sep 17 00:00:00 2001 From: spaenleh Date: Mon, 6 Jan 2025 14:55:12 +0100 Subject: [PATCH 1/2] fix: add redirection page for login from legacy services --- src/routeTree.gen.ts | 53 ++++++++++++++++++++++++++++++++++++++ src/routes/auth/signin.tsx | 10 +++++++ src/routes/signin.tsx | 10 +++++++ 3 files changed, 73 insertions(+) create mode 100644 src/routes/auth/signin.tsx create mode 100644 src/routes/signin.tsx diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts index 6d6af7745..5537e94b0 100644 --- a/src/routeTree.gen.ts +++ b/src/routeTree.gen.ts @@ -13,6 +13,7 @@ import { createFileRoute } from '@tanstack/react-router' // Import Routes import { Route as rootRoute } from './routes/__root' +import { Route as SigninImport } from './routes/signin' import { Route as AuthImport } from './routes/auth' import { Route as AnalyticsImport } from './routes/analytics' import { Route as AccountImport } from './routes/account' @@ -22,6 +23,7 @@ import { Route as AnalyticsIndexImport } from './routes/analytics/index' import { Route as AccountIndexImport } from './routes/account/index' import { Route as EmailChangeImport } from './routes/email.change' import { Route as AuthSuccessImport } from './routes/auth/success' +import { Route as AuthSigninImport } from './routes/auth/signin' import { Route as AuthResetPasswordImport } from './routes/auth/reset-password' import { Route as AuthRegisterImport } from './routes/auth/register' import { Route as AuthLoginImport } from './routes/auth/login' @@ -55,6 +57,12 @@ const AnalyticsItemsItemIdLazyImport = createFileRoute( // Create/Update Routes +const SigninRoute = SigninImport.update({ + id: '/signin', + path: '/signin', + getParentRoute: () => rootRoute, +} as any) + const AuthRoute = AuthImport.update({ id: '/auth', path: '/auth', @@ -116,6 +124,12 @@ const AuthSuccessRoute = AuthSuccessImport.update({ getParentRoute: () => AuthRoute, } as any) +const AuthSigninRoute = AuthSigninImport.update({ + id: '/signin', + path: '/signin', + getParentRoute: () => AuthRoute, +} as any) + const AuthResetPasswordRoute = AuthResetPasswordImport.update({ id: '/reset-password', path: '/reset-password', @@ -297,6 +311,13 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof AuthImport parentRoute: typeof rootRoute } + '/signin': { + id: '/signin' + path: '/signin' + fullPath: '/signin' + preLoaderRoute: typeof SigninImport + parentRoute: typeof rootRoute + } '/_landing/about-us': { id: '/_landing/about-us' path: '/about-us' @@ -395,6 +416,13 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof AuthResetPasswordImport parentRoute: typeof AuthImport } + '/auth/signin': { + id: '/auth/signin' + path: '/signin' + fullPath: '/auth/signin' + preLoaderRoute: typeof AuthSigninImport + parentRoute: typeof AuthImport + } '/auth/success': { id: '/auth/success' path: '/success' @@ -595,6 +623,7 @@ interface AuthRouteChildren { AuthLoginRoute: typeof AuthLoginRoute AuthRegisterRoute: typeof AuthRegisterRoute AuthResetPasswordRoute: typeof AuthResetPasswordRoute + AuthSigninRoute: typeof AuthSigninRoute AuthSuccessRoute: typeof AuthSuccessRoute } @@ -603,6 +632,7 @@ const AuthRouteChildren: AuthRouteChildren = { AuthLoginRoute: AuthLoginRoute, AuthRegisterRoute: AuthRegisterRoute, AuthResetPasswordRoute: AuthResetPasswordRoute, + AuthSigninRoute: AuthSigninRoute, AuthSuccessRoute: AuthSuccessRoute, } @@ -626,6 +656,7 @@ export interface FileRoutesByFullPath { '/account': typeof AccountRouteWithChildren '/analytics': typeof AnalyticsRouteWithChildren '/auth': typeof AuthRouteWithChildren + '/signin': typeof SigninRoute '/about-us': typeof LandingAboutUsRoute '/contact-us': typeof LandingContactUsRoute '/disclaimer': typeof LandingDisclaimerRoute @@ -640,6 +671,7 @@ export interface FileRoutesByFullPath { '/auth/login': typeof AuthLoginRoute '/auth/register': typeof AuthRegisterRoute '/auth/reset-password': typeof AuthResetPasswordRoute + '/auth/signin': typeof AuthSigninRoute '/auth/success': typeof AuthSuccessRoute '/email/change': typeof EmailChangeRoute '/account/': typeof AccountIndexRoute @@ -660,6 +692,7 @@ export interface FileRoutesByFullPath { export interface FileRoutesByTo { '/auth': typeof AuthRouteWithChildren + '/signin': typeof SigninRoute '/about-us': typeof LandingAboutUsRoute '/contact-us': typeof LandingContactUsRoute '/disclaimer': typeof LandingDisclaimerRoute @@ -674,6 +707,7 @@ export interface FileRoutesByTo { '/auth/login': typeof AuthLoginRoute '/auth/register': typeof AuthRegisterRoute '/auth/reset-password': typeof AuthResetPasswordRoute + '/auth/signin': typeof AuthSigninRoute '/auth/success': typeof AuthSuccessRoute '/email/change': typeof EmailChangeRoute '/account': typeof AccountIndexRoute @@ -696,6 +730,7 @@ export interface FileRoutesById { '/account': typeof AccountRouteWithChildren '/analytics': typeof AnalyticsRouteWithChildren '/auth': typeof AuthRouteWithChildren + '/signin': typeof SigninRoute '/_landing/about-us': typeof LandingAboutUsRoute '/_landing/contact-us': typeof LandingContactUsRoute '/_landing/disclaimer': typeof LandingDisclaimerRoute @@ -710,6 +745,7 @@ export interface FileRoutesById { '/auth/login': typeof AuthLoginRoute '/auth/register': typeof AuthRegisterRoute '/auth/reset-password': typeof AuthResetPasswordRoute + '/auth/signin': typeof AuthSigninRoute '/auth/success': typeof AuthSuccessRoute '/email/change': typeof EmailChangeRoute '/account/': typeof AccountIndexRoute @@ -735,6 +771,7 @@ export interface FileRouteTypes { | '/account' | '/analytics' | '/auth' + | '/signin' | '/about-us' | '/contact-us' | '/disclaimer' @@ -749,6 +786,7 @@ export interface FileRouteTypes { | '/auth/login' | '/auth/register' | '/auth/reset-password' + | '/auth/signin' | '/auth/success' | '/email/change' | '/account/' @@ -768,6 +806,7 @@ export interface FileRouteTypes { fileRoutesByTo: FileRoutesByTo to: | '/auth' + | '/signin' | '/about-us' | '/contact-us' | '/disclaimer' @@ -782,6 +821,7 @@ export interface FileRouteTypes { | '/auth/login' | '/auth/register' | '/auth/reset-password' + | '/auth/signin' | '/auth/success' | '/email/change' | '/account' @@ -802,6 +842,7 @@ export interface FileRouteTypes { | '/account' | '/analytics' | '/auth' + | '/signin' | '/_landing/about-us' | '/_landing/contact-us' | '/_landing/disclaimer' @@ -816,6 +857,7 @@ export interface FileRouteTypes { | '/auth/login' | '/auth/register' | '/auth/reset-password' + | '/auth/signin' | '/auth/success' | '/email/change' | '/account/' @@ -840,6 +882,7 @@ export interface RootRouteChildren { AccountRoute: typeof AccountRouteWithChildren AnalyticsRoute: typeof AnalyticsRouteWithChildren AuthRoute: typeof AuthRouteWithChildren + SigninRoute: typeof SigninRoute EmailChangeRoute: typeof EmailChangeRoute PlayerIndexRoute: typeof PlayerIndexRoute PlayerRootIdItemIdRoute: typeof PlayerRootIdItemIdRouteWithChildren @@ -851,6 +894,7 @@ const rootRouteChildren: RootRouteChildren = { AccountRoute: AccountRouteWithChildren, AnalyticsRoute: AnalyticsRouteWithChildren, AuthRoute: AuthRouteWithChildren, + SigninRoute: SigninRoute, EmailChangeRoute: EmailChangeRoute, PlayerIndexRoute: PlayerIndexRoute, PlayerRootIdItemIdRoute: PlayerRootIdItemIdRouteWithChildren, @@ -871,6 +915,7 @@ export const routeTree = rootRoute "/account", "/analytics", "/auth", + "/signin", "/email/change", "/player/", "/player/$rootId/$itemId", @@ -913,9 +958,13 @@ export const routeTree = rootRoute "/auth/login", "/auth/register", "/auth/reset-password", + "/auth/signin", "/auth/success" ] }, + "/signin": { + "filePath": "signin.tsx" + }, "/_landing/about-us": { "filePath": "_landing/about-us.tsx", "parent": "/_landing" @@ -972,6 +1021,10 @@ export const routeTree = rootRoute "filePath": "auth/reset-password.tsx", "parent": "/auth" }, + "/auth/signin": { + "filePath": "auth/signin.tsx", + "parent": "/auth" + }, "/auth/success": { "filePath": "auth/success.tsx", "parent": "/auth" diff --git a/src/routes/auth/signin.tsx b/src/routes/auth/signin.tsx new file mode 100644 index 000000000..bfce63ed1 --- /dev/null +++ b/src/routes/auth/signin.tsx @@ -0,0 +1,10 @@ +import { createFileRoute, redirect } from '@tanstack/react-router'; + +// legacy redirection for routes using the old `signin` route. +// this should be removed 6 months after the push of the new client interface in production. +// estimated date at time of writing is July 2025 +export const Route = createFileRoute('/auth/signin')({ + beforeLoad: (ctx) => { + throw redirect({ to: '/auth/login', search: ctx.search }); + }, +}); diff --git a/src/routes/signin.tsx b/src/routes/signin.tsx new file mode 100644 index 000000000..b2613926b --- /dev/null +++ b/src/routes/signin.tsx @@ -0,0 +1,10 @@ +import { createFileRoute, redirect } from '@tanstack/react-router'; + +// legacy redirection for routes using the old `signin` route. +// this should be removed 6 months after the push of the new client interface in production. +// estimated date at time of writing is July 2025 +export const Route = createFileRoute('/signin')({ + beforeLoad: (ctx) => { + throw redirect({ to: '/auth/login', search: ctx.search }); + }, +}); From 153f47f7b3cf973263fc0f242cd6249b022678c5 Mon Sep 17 00:00:00 2001 From: spaenleh Date: Wed, 8 Jan 2025 13:38:41 +0100 Subject: [PATCH 2/2] chore: update comment with better phrasing --- src/routes/auth/signin.tsx | 9 ++++++--- src/routes/signin.tsx | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/routes/auth/signin.tsx b/src/routes/auth/signin.tsx index bfce63ed1..de6cf8af2 100644 --- a/src/routes/auth/signin.tsx +++ b/src/routes/auth/signin.tsx @@ -1,8 +1,11 @@ import { createFileRoute, redirect } from '@tanstack/react-router'; -// legacy redirection for routes using the old `signin` route. -// this should be removed 6 months after the push of the new client interface in production. -// estimated date at time of writing is July 2025 +/** + * Legacy redirection for routes using the old `signin` route. + * + * This should be removed 6 months after the push of the new client interface in production, + * approximately around July 2025. + */ export const Route = createFileRoute('/auth/signin')({ beforeLoad: (ctx) => { throw redirect({ to: '/auth/login', search: ctx.search }); diff --git a/src/routes/signin.tsx b/src/routes/signin.tsx index b2613926b..816621560 100644 --- a/src/routes/signin.tsx +++ b/src/routes/signin.tsx @@ -1,8 +1,11 @@ import { createFileRoute, redirect } from '@tanstack/react-router'; -// legacy redirection for routes using the old `signin` route. -// this should be removed 6 months after the push of the new client interface in production. -// estimated date at time of writing is July 2025 +/** + * Legacy redirection for routes using the old `signin` route. + * + * This should be removed 6 months after the push of the new client interface in production, + * approximately around July 2025. + */ export const Route = createFileRoute('/signin')({ beforeLoad: (ctx) => { throw redirect({ to: '/auth/login', search: ctx.search });