summaryrefslogtreecommitdiffhomepage
path: root/src/features/workspaces/logic/route.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-26 22:21:55 +0900
committerAdam Malczewski <[email protected]>2026-06-26 22:23:39 +0900
commit9b0b4e5ef52c5e4383d6c4a2041ca1a73ea4bc44 (patch)
treedb67a714911ab7cfa70c054c6951ffca1c58550d /src/features/workspaces/logic/route.ts
parent306f28a7732e11e3de1c6d0c4d26cadb92b25d3e (diff)
downloaddispatch-web-9b0b4e5ef52c5e4383d6c4a2041ca1a73ea4bc44.tar.gz
dispatch-web-9b0b4e5ef52c5e4383d6c4a2041ca1a73ea4bc44.zip
style: switch from tabs to 2-space indentation (incl. svelte)
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;
+ }
}