Move
This commit is contained in:
parent
b2fda16561
commit
babe378301
3 changed files with 29 additions and 18 deletions
24
web/packages/accounts/services/redirect.ts
Normal file
24
web/packages/accounts/services/redirect.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import type { AppName } from "@/next/types/app";
|
||||
import {
|
||||
ACCOUNTS_PAGES,
|
||||
AUTH_PAGES,
|
||||
PHOTOS_PAGES,
|
||||
} from "@ente/shared/constants/pages";
|
||||
|
||||
/**
|
||||
* The "home" route for each of our apps.
|
||||
*
|
||||
* This is where we redirect to after successful authentication.
|
||||
*/
|
||||
export const appHomeRoute = (appName: AppName): string => {
|
||||
switch (appName) {
|
||||
case "account":
|
||||
return ACCOUNTS_PAGES.PASSKEYS;
|
||||
case "albums":
|
||||
return "/";
|
||||
case "auth":
|
||||
return AUTH_PAGES.AUTH;
|
||||
case "photos":
|
||||
return PHOTOS_PAGES.GALLERY;
|
||||
}
|
||||
};
|
5
web/packages/next/types/app.ts
Normal file
5
web/packages/next/types/app.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
/**
|
||||
* Arbitrary names that we used as keys for indexing various constants
|
||||
* corresponding to our apps.
|
||||
*/
|
||||
export type AppName = "account" | "albums" | "auth" | "photos";
|
|
@ -1,23 +1,5 @@
|
|||
import { ACCOUNTS_PAGES, AUTH_PAGES, PHOTOS_PAGES } from "../constants/pages";
|
||||
|
||||
/**
|
||||
* Arbitrary names that we used as keys for indexing various constants
|
||||
* corresponding to our apps.
|
||||
*/
|
||||
export type AppName = "account" | "albums" | "auth" | "photos";
|
||||
|
||||
/**
|
||||
* The "home" route for each of our apps.
|
||||
*
|
||||
* This is where we redirect to, e.g, after successful authentication.
|
||||
*/
|
||||
export const appHomeRoute: Record<AppName, string> = {
|
||||
account: ACCOUNTS_PAGES.PASSKEYS,
|
||||
albums: "/",
|
||||
auth: AUTH_PAGES.AUTH,
|
||||
photos: PHOTOS_PAGES.GALLERY,
|
||||
};
|
||||
|
||||
export enum APPS {
|
||||
PHOTOS = "PHOTOS",
|
||||
AUTH = "AUTH",
|
||||
|
|
Loading…
Reference in a new issue