From 71e4ad2c71efea471923ea47f01bfda841387f81 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Sun, 10 Mar 2024 01:31:42 +0000 Subject: Use nuxt auto import magic --- lib/util.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib') 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 -- cgit v1.2.3-70-g09d2