timon_playgroud/frontend/src/components/PageNotFound.vue

45 lines
906 B
Vue

<template>
<a-result
status="404"
title="404"
:sub-title="t('common.not_found.page_not_found')"
>
<template #extra>
<a-button v-if="page.authed" type="primary" @click="backHome">{{
t("common.not_found.return")
}}</a-button>
</template>
</a-result>
</template>
<script lang="ts" setup>
import { useAuthStore } from "@/stores/auth";
import router from "@/router";
import {
RouteAdminDashboard,
RouteLogin,
RouteUserProfile,
} from "@/router/consts";
import { useI18n } from "vue-i18n";
import { onMounted, reactive } from "vue";
const { t } = useI18n();
const page = reactive<{
authed: boolean;
}>({
authed: false,
});
onMounted(() => {
page.authed = useAuthStore().authed;
});
function backHome() {
if (useAuthStore().isAdmin) {
return router.push(RouteAdminDashboard);
} else {
return router.push(RouteUserProfile);
}
}
</script>