@@ -3,7 +3,6 @@ import axios from '@/axios'
|
||||
import { useUser } from './user'
|
||||
import { useNotifications } from './notifications'
|
||||
import Axios from 'axios'
|
||||
import { stubFalse } from 'lodash'
|
||||
|
||||
const user = useUser()
|
||||
const notifications = useNotifications()
|
||||
@@ -117,13 +116,19 @@ export const useEmployee = defineStore({
|
||||
|
||||
Object.assign(this.clean.employee, this.employee)
|
||||
notifications.add('success', result.statusText)
|
||||
return true
|
||||
}
|
||||
catch(error) {
|
||||
if(error instanceof Error) {
|
||||
console.log(error)
|
||||
console.log("Patch Employee Error")
|
||||
if(Axios.isAxiosError(error)) {
|
||||
let data = error.response?.data as { errors: EmployeeApiValidationError[] }
|
||||
this.apiValidationErrors = [...data.errors]
|
||||
}
|
||||
else if(error instanceof Error) {
|
||||
notifications.add('danger', error.message, -1)
|
||||
}
|
||||
else console.log(error)
|
||||
console.log(error)
|
||||
return false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -142,17 +147,18 @@ export const useEmployee = defineStore({
|
||||
this.assignTruthyValues(this.clean.employee, result.data)
|
||||
notifications.add('success', result.statusText)
|
||||
|
||||
console.log(result)
|
||||
return true
|
||||
}
|
||||
catch(error){
|
||||
console.log("enter catch")
|
||||
console.log("Post Employee Error")
|
||||
if(Axios.isAxiosError(error)) {
|
||||
console.log("enter axios error")
|
||||
let data = error.response?.data as { errors: EmployeeApiValidationError[] }
|
||||
console.log(data)
|
||||
this.apiValidationErrors = [...data.errors]
|
||||
}
|
||||
else if(error instanceof Error) {
|
||||
notifications.add('danger', error.message, -1)
|
||||
}
|
||||
console.log(error)
|
||||
return false
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user