mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
доработка админ панели
This commit is contained in:
@@ -132,12 +132,11 @@ export default {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
validateStatus: function (status) {
|
||||
return status < 500 // Разрешаем все статусы < 500
|
||||
return status < 500
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
if (response.status === 307) {
|
||||
// Если получили редирект, делаем запрос по новому URL
|
||||
const redirectUrl = response.headers.location
|
||||
const finalResponse = await axios.post(redirectUrl, this.formData, {
|
||||
headers: {
|
||||
|
@@ -101,9 +101,23 @@ export default {
|
||||
const response = await axios.get('/api/employees', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem('admin_token')}`
|
||||
},
|
||||
validateStatus: function (status) {
|
||||
return status < 500
|
||||
}
|
||||
})
|
||||
this.employees = response.data
|
||||
|
||||
if (response.status === 307) {
|
||||
const redirectUrl = response.headers.location
|
||||
const finalResponse = await axios.get(redirectUrl, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem('admin_token')}`
|
||||
}
|
||||
})
|
||||
this.employees = finalResponse.data
|
||||
} else {
|
||||
this.employees = response.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching employees:', error)
|
||||
}
|
||||
|
@@ -62,6 +62,7 @@
|
||||
v-if="showEmployeesModal"
|
||||
:isOpen="showEmployeesModal"
|
||||
@close="showEmployeesModal = false"
|
||||
ref="employeesModal"
|
||||
/>
|
||||
|
||||
<RequestsModal
|
||||
@@ -116,8 +117,8 @@ export default {
|
||||
},
|
||||
handleEmployeeAdded() {
|
||||
// Обновляем список сотрудников, если модальное окно списка открыто
|
||||
if (this.showEmployeesModal) {
|
||||
this.$refs.employeesModal?.fetchEmployees()
|
||||
if (this.showEmployeesModal && this.$refs.employeesModal) {
|
||||
this.$refs.employeesModal.fetchEmployees()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user