generated from VLADIMIR/template_frontend
add refresh
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user