Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Move

Manav Rathibabe378301b7
diff --git a/web/packages/accounts/services/redirect.ts b/web/packages/accounts/services/redirect.ts
new file mode 100644
index 0000000000..084d001ec5
--- /dev/null
+++ b/web/packages/accounts/services/redirect.ts
@@ -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;
+ }
+};
diff --git a/web/packages/next/types/app.ts b/web/packages/next/types/app.ts
new file mode 100644
index 0000000000..8818a09e56
--- /dev/null
+++ b/web/packages/next/types/app.ts
@@ -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";
diff --git a/web/packages/shared/apps/constants.ts b/web/packages/shared/apps/constants.ts
index 3fcf0dcdd4..b679fb9123 100644
--- a/web/packages/shared/apps/constants.ts
+++ b/web/packages/shared/apps/constants.ts
@@ -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",