diff --git a/README.md b/README.md index 2bdb3e9..aec108f 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,5 @@ idk jvs, seems to work on my machine... and yours too now??? - [ ] forgot password shows success toast even w no captcha (doesn't actually submit) - [ ] signup birthdate editor -- [ ] need error page -- [ ] need 404 page - - +- [X] need error page +- [X] need 404 page diff --git a/src/assets/images/err_bandwidthlost.png b/src/assets/images/err_bandwidthlost.png new file mode 100644 index 0000000..4b03ea2 Binary files /dev/null and b/src/assets/images/err_bandwidthlost.png differ diff --git a/src/components/Navbar/Navbar.vue b/src/components/Navbar/Navbar.vue index 88dd862..f8f7aa1 100644 --- a/src/components/Navbar/Navbar.vue +++ b/src/components/Navbar/Navbar.vue @@ -26,11 +26,17 @@ function scoreLocale(cObj: LocaleObject): number { return 2; } } -const sortedLocales = locales.value.sort((a, b) => { - const sA = scoreLocale(a); - const sB = scoreLocale(b); - return sA - sB || (a?.name || '').localeCompare(b?.name || '', locale.value); +const sortedLocales = computed(() => { + const sorted = [...locales.value]; + sorted.sort((a, b) => { + const sA = scoreLocale(a); + const sB = scoreLocale(b); + + return sA - sB || (a?.name || '').localeCompare(b?.name || '', locale.value); + }); + + return sorted; }); const me = useMeStore(); diff --git a/src/error.vue b/src/error.vue new file mode 100644 index 0000000..a2026d5 --- /dev/null +++ b/src/error.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/src/locales/en_US.json b/src/locales/en_US.json index 5ab7449..1ff9c12 100644 --- a/src/locales/en_US.json +++ b/src/locales/en_US.json @@ -341,7 +341,13 @@ "confirm": "Confirm", "close": "Close" }, + "errorPage": { + "500": { + "title": "Server error!", + "description": "Please try again later." + } + }, "notfound": { "description": "Oops! We could not find this page." } -} \ No newline at end of file +} diff --git a/src/pages/account/index.vue b/src/pages/account/index.vue index 4e0bc0f..c5b41af 100644 --- a/src/pages/account/index.vue +++ b/src/pages/account/index.vue @@ -51,15 +51,23 @@ watchImmediate(discordLinkQuery, (val) => { useRouter().replace({ query: {} }); }); -const { data: profile, refresh } = await useApiFetch('/api/auth/me'); -const { data: connections, refresh: refreshConnections } = await useApiFetch('/api/auth/me-connections'); - -const selectedServerEnv = ref(profile.value?.serverAccessLevel); const dialogContainer = ref(null); const deleteModalOpen = ref(false); const editModalOpen = ref(false); +const selectedServerEnv = ref(''); +const { data: profile, refresh } = await useApiFetch('/api/auth/me', { + onResponse: (opt) => { + selectedServerEnv.value = opt.response._data?.serverAccessLevel; + } +}); +const { data: connections, refresh: refreshConnections } = await useApiFetch( + '/api/auth/me-connections' +); -const { execute: executeUpdateServerEnvironment, isLoading: isLoadingUpdateServerEnv } = useAsync({ +const { + execute: executeUpdateServerEnvironment, + isLoading: isLoadingUpdateServerEnv +} = useAsync({ async handler(env: ApiAccountUpdateRequest['environment']) { await apiFetch('/api/account/update', { method: 'PATCH', @@ -131,7 +139,6 @@ const { execute: executeUnlinkDiscord, isLoading: isLoadingUnlink } = useAsync({ useHead({ title: `Account` }); -