This commit is contained in:
2026-07-19 01:32:15 +07:00
parent c1a113b849
commit 7ce91ecd49
4 changed files with 163 additions and 92 deletions
+21 -31
View File
@@ -1,9 +1,25 @@
<script setup lang="ts">
import { getAuthClient } from '@/api/auth_client';
import { useAuthStore } from '@/stores/auth';
import { ref } from 'vue';
import HeaderMenu from '@/components/HeaderMenu.vue'
const authStore = useAuthStore();
const client = getAuthClient();
const permissions = ref<string[]>([])
async function getPermissions() {
permissions.value = []
const res = await client.GetPermissions({})
permissions.value = res.permissions!
}
getPermissions()
</script>
<template>
<header class="header">
<p @click="goToLogout" class="btn-login">
Выйти
</p>
</header>
<HeaderMenu :add-logout="true"/>
<p>
Доброго времени суток, {{ authStore.username }}.
@@ -12,33 +28,7 @@
{{ authStore.userRoles }}
</p>
<button @click="getPermissions">Права</button>
{{ permissions }}
</template>
<script setup lang="ts">
import { getAuthClient } from '@/api/auth_client';
import router from '@/router';
import { useAuthStore } from '@/stores/auth';
import { ref } from 'vue';
const authStore = useAuthStore();
const client = getAuthClient()
const permissions = ref<string[]>([])
const goToLogout = () => {
authStore.logout()
router.push('/login')
}
async function getPermissions() {
permissions.value = []
const res = await client.GetPermissions({})
permissions.value = res.permissions!
}
</script>
<style scoped></style>