summaryrefslogtreecommitdiffhomepage
path: root/src/features/workspaces/logic/route.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-27 01:13:28 +0900
committerAdam Malczewski <[email protected]>2026-06-27 01:13:31 +0900
commit0a271e3e8aecb1ec9db3eea873b3df1ecaab8b99 (patch)
tree0a5a6e62acf2d8e15ec69fd09f641cd75a1bcb10 /src/features/workspaces/logic/route.ts
parent397ce9b65b888121d8c7e909c37dfdbffe914673 (diff)
parent576f539670f406280f8398abf78a867d70b683b8 (diff)
downloaddispatch-web-0a271e3e8aecb1ec9db3eea873b3df1ecaab8b99.tar.gz
dispatch-web-0a271e3e8aecb1ec9db3eea873b3df1ecaab8b99.zip
Merge branch 'dev' into feature/heartbeat
# Conflicts: # src/app/App.svelte # src/app/store.svelte.ts # src/app/store.test.ts # src/features/workspaces/ui/WorkspaceCard.test.ts
Diffstat (limited to 'src/features/workspaces/logic/route.ts')
-rw-r--r--src/features/workspaces/logic/route.ts26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/features/workspaces/logic/route.ts b/src/features/workspaces/logic/route.ts
index e30dc16..015c6d6 100644
--- a/src/features/workspaces/logic/route.ts
+++ b/src/features/workspaces/logic/route.ts
@@ -30,12 +30,12 @@ export const DEFAULT_WORKSPACE_ID = "default";
* surfaces the error).
*/
export function parsePath(pathname: string): Route {
- const trimmed = pathname.replace(/^\/+|\/+$/g, "");
- if (trimmed === "") return { kind: "home" };
- const first = trimmed.split("/")[0] ?? "";
- const id = safeDecode(first);
- if (id === "") return { kind: "home" };
- return { kind: "workspace", id };
+ const trimmed = pathname.replace(/^\/+|\/+$/g, "");
+ if (trimmed === "") return { kind: "home" };
+ const first = trimmed.split("/")[0] ?? "";
+ const id = safeDecode(first);
+ if (id === "") return { kind: "home" };
+ return { kind: "workspace", id };
}
/**
@@ -43,7 +43,7 @@ export function parsePath(pathname: string): Route {
* Used by the home view's "new workspace" input before navigating.
*/
export function isValidSlug(slug: string): boolean {
- return WORKSPACE_SLUG_RE.test(slug);
+ return WORKSPACE_SLUG_RE.test(slug);
}
/**
@@ -51,13 +51,13 @@ export function isValidSlug(slug: string): boolean {
* workspace. Pure: id in, path string out.
*/
export function workspacePath(id: string): string {
- return `/${id}`;
+ return `/${id}`;
}
function safeDecode(segment: string): string {
- try {
- return decodeURIComponent(segment);
- } catch {
- return segment;
- }
+ try {
+ return decodeURIComponent(segment);
+ } catch {
+ return segment;
+ }
}