aboutsummaryrefslogtreecommitdiffstats
path: root/lib/util.ts
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2024-03-10 01:31:42 +0000
committerLeonardo Bishop <me@leonardobishop.com>2024-03-10 01:31:42 +0000
commit71e4ad2c71efea471923ea47f01bfda841387f81 (patch)
treef08293fdc56b4eb2e3d0e520b79b4d8aad78924c /lib/util.ts
parent4495c02c41b95ce6df0c34dbf6ac62f7addae7a3 (diff)
Use nuxt auto import magic
Diffstat (limited to 'lib/util.ts')
-rw-r--r--lib/util.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/util.ts b/lib/util.ts
index b8be8cb..3a7e9aa 100644
--- a/lib/util.ts
+++ b/lib/util.ts
@@ -15,4 +15,16 @@ export function validateCategoryId(id: string): boolean {
export function validateTaskId(id: string): boolean {
return VALID_ID_REGEX.test(id);
+}
+
+export function navigateToEditorPane(type: 'quest' | 'category' | null, id?: string) {
+ if (id) {
+ if (type === 'category') {
+ navigateTo({ path: '/category/' + id })
+ } else if (type === 'quest') {
+ navigateTo({ path: '/quest/' + id })
+ }
+ } else if (!id && !type) {
+ navigateTo({ path: '/' })
+ }
} \ No newline at end of file