Some refactoring, added dynamic route for EmployeesDetails
This commit is contained in:
@@ -21,7 +21,7 @@ async function onLogout() {
|
|||||||
<router-link
|
<router-link
|
||||||
v-if="userStore.isLoggedIn"
|
v-if="userStore.isLoggedIn"
|
||||||
class="nav-link"
|
class="nav-link"
|
||||||
:to="{name: 'Profile'}"
|
to="/employees/me"
|
||||||
>
|
>
|
||||||
Profile
|
Profile
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/employees/me',
|
path: '/employees/:id',
|
||||||
name: 'Profile',
|
name: 'EmployeesDetails',
|
||||||
component: () => import('@/views/Profile.vue'),
|
component: () => import('@/views/EmployeesDetails.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
requiresAuth: true,
|
requiresAuth: true,
|
||||||
requiresAdmin: false
|
requiresAdmin: false
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import { reactive, onMounted } from 'vue'
|
|||||||
import { useUser } from '@/stores/user';
|
import { useUser } from '@/stores/user';
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { useNotifications } from '@/stores/notifications';
|
import { useNotifications } from '@/stores/notifications';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
const userStore = useUser()
|
const userStore = useUser()
|
||||||
const useNotification = useNotifications()
|
const useNotification = useNotifications()
|
||||||
@@ -61,7 +62,9 @@ onMounted(async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data : ResultData = await <ResultData>(await ai.get('employees/me')).data
|
const id = useRoute().params.id
|
||||||
|
|
||||||
|
const data : ResultData = await <ResultData>(await ai.get('employees/'+id)).data
|
||||||
|
|
||||||
Object.assign(employee, data.employee)
|
Object.assign(employee, data.employee)
|
||||||
Object.assign(user, data.user)
|
Object.assign(user, data.user)
|
||||||
Reference in New Issue
Block a user