add refresh

This commit is contained in:
2026-07-18 18:42:05 +07:00
parent 0731123fbb
commit 28f1e43338
3 changed files with 66 additions and 22 deletions
+15
View File
@@ -11,19 +11,34 @@
<p>
{{ authStore.userRoles }}
</p>
<button @click="getPermissions">Права</button>
{{ permissions }}
</template>
<script setup lang="ts">
import { buildAuthClient } from '@/api/auth_client';
import router from '@/router';
import { useAuthStore } from '@/stores/auth';
import { ref } from 'vue';
const authStore = useAuthStore();
const client = buildAuthClient(authStore.refreshTokenAction, authStore.getToken)
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>