Bổ sung check lỗi không có quyền khi xóa nôte

This commit is contained in:
Truong Vo 2024-08-09 15:16:07 +07:00
parent 4744ac3e23
commit 072d8ccad7
1 changed files with 10 additions and 3 deletions

View File

@ -36,7 +36,7 @@ export const create = async (
if (res.status === false) {
notifications.show({
title: 'Error',
message: res.message??_NOTIFICATION_MESS.create_error,
message: res.message ?? _NOTIFICATION_MESS.create_error,
color: 'red',
})
}
@ -87,7 +87,7 @@ export const update = async (
if (res.status === false) {
notifications.show({
title: 'Error',
message: res.message??_NOTIFICATION_MESS.update_error,
message: res.message ?? _NOTIFICATION_MESS.update_error,
color: 'red',
})
}
@ -127,7 +127,7 @@ export const Xdelete = async (url: string, data: any, fnc?: () => void) => {
if (res.status === false) {
notifications.show({
title: 'Error',
message: res.message??_NOTIFICATION_MESS.delete_error,
message: res.message ?? _NOTIFICATION_MESS.delete_error,
color: 'red',
})
}
@ -135,6 +135,13 @@ export const Xdelete = async (url: string, data: any, fnc?: () => void) => {
return res.status
} catch (error: any) {
console.log(error)
if (error?.status == false) {
notifications.show({
title: 'Error',
message: error.message ?? _NOTIFICATION_MESS.delete_error,
color: 'red',
})
}
if (error.response.status === 422) {
const errorMess = error.response.data.message
notifications.show({