forked from verdnatura/salix-front
Store user roles
This commit is contained in:
parent
dc1f75b5e9
commit
6e336a22d8
File diff suppressed because it is too large
Load Diff
|
@ -28,8 +28,11 @@ const token = session.getToken();
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const roles = await axios.get('/api/accounts/acl')
|
const { data } = await axios.get('/api/accounts/acl');
|
||||||
state.setUser(roles.user);
|
const roles = data.roles.map(userRoles => userRoles.role.name);
|
||||||
|
|
||||||
|
state.setUser(data.user);
|
||||||
|
state.setRoles(roles);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
quasar.notify({
|
quasar.notify({
|
||||||
message: t('errors.statusUnauthorized'),
|
message: t('errors.statusUnauthorized'),
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
|
import { useRole } from '/src/composables/useRole';
|
||||||
|
|
||||||
const slide = ref('style');
|
const slide = ref('style');
|
||||||
const slideText = 'Description text';
|
const slideText = 'Description text';
|
||||||
|
|
||||||
|
const { hasAny } = useRole();
|
||||||
|
|
||||||
|
const isSalesPerson = computed(() => hasAny(['salesPerson']));
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -12,7 +19,7 @@ const slideText = 'Description text';
|
||||||
rounded
|
rounded
|
||||||
class="bg-orange text-white q-mb-lg"
|
class="bg-orange text-white q-mb-lg"
|
||||||
>
|
>
|
||||||
You have lost connection to the internet. This app is offline.
|
{{ isSalesPerson }}
|
||||||
<template #action>
|
<template #action>
|
||||||
<q-btn flat label="Turn ON Wifi" />
|
<q-btn flat label="Turn ON Wifi" />
|
||||||
<q-btn flat label="Dismiss" />
|
<q-btn flat label="Dismiss" />
|
||||||
|
|
|
@ -3,7 +3,8 @@ export default {
|
||||||
name: 'Customer',
|
name: 'Customer',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'customers',
|
title: 'customers',
|
||||||
icon: 'vn:client'
|
icon: 'vn:client',
|
||||||
|
roles: ['salesPerson'],
|
||||||
},
|
},
|
||||||
component: () => import('src/pages/Customer/CustomerLayout.vue'),
|
component: () => import('src/pages/Customer/CustomerLayout.vue'),
|
||||||
redirect: { path: '/customer/list' },
|
redirect: { path: '/customer/list' },
|
||||||
|
|
Loading…
Reference in New Issue