edit: response.message
This commit is contained in:
parent
d7f824f353
commit
7de5457170
21 changed files with 227 additions and 127 deletions
|
|
@ -11,11 +11,11 @@
|
|||
icon="download"
|
||||
@click="exportExcel"
|
||||
/>
|
||||
<q-btn
|
||||
<!-- <q-btn
|
||||
color="primary"
|
||||
label="+ เพิ่มผู้ใช้ใหม่"
|
||||
@click="showAddModal = true"
|
||||
/>
|
||||
/> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -279,7 +279,7 @@ const fetchUsers = async () => {
|
|||
} catch (error) {
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: 'ไม่สามารถโหลดข้อมูลผู้ใช้ได้',
|
||||
message: (error as any).data?.message || 'ไม่สามารถโหลดข้อมูลผู้ใช้ได้',
|
||||
position: 'top'
|
||||
});
|
||||
} finally {
|
||||
|
|
@ -326,7 +326,7 @@ const changeRole = (user: AdminUserResponse) => {
|
|||
message: `เลือก Role ใหม่สำหรับ ${user.profile.first_name}`,
|
||||
options: {
|
||||
type: 'radio',
|
||||
model: roleIds[user.role.code],
|
||||
model: roleIds[user.role.code] as any,
|
||||
items: [
|
||||
{ label: 'Instructor', value: 1 },
|
||||
{ label: 'Student', value: 2 },
|
||||
|
|
@ -337,17 +337,17 @@ const changeRole = (user: AdminUserResponse) => {
|
|||
persistent: true
|
||||
}).onOk(async (roleId: number) => {
|
||||
try {
|
||||
await adminService.updateUserRole(user.id, roleId);
|
||||
const response = await adminService.updateUserRole(user.id, roleId);
|
||||
$q.notify({
|
||||
type: 'positive',
|
||||
message: 'เปลี่ยน Role สำเร็จ',
|
||||
message: response.message || 'เปลี่ยน Role สำเร็จ',
|
||||
position: 'top'
|
||||
});
|
||||
fetchUsers();
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: 'เกิดข้อผิดพลาดในการเปลี่ยน Role',
|
||||
message: error.data?.message || 'เกิดข้อผิดพลาดในการเปลี่ยน Role',
|
||||
position: 'top'
|
||||
});
|
||||
}
|
||||
|
|
@ -362,17 +362,17 @@ const confirmDelete = (user: AdminUserResponse) => {
|
|||
persistent: true
|
||||
}).onOk(async () => {
|
||||
try {
|
||||
await adminService.deleteUser(user.id);
|
||||
const response = await adminService.deleteUser(user.id);
|
||||
$q.notify({
|
||||
type: 'positive',
|
||||
message: 'ลบผู้ใช้สำเร็จ',
|
||||
message: response.message || 'ลบผู้ใช้สำเร็จ',
|
||||
position: 'top'
|
||||
});
|
||||
fetchUsers();
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: 'เกิดข้อผิดพลาดในการลบผู้ใช้',
|
||||
message: error.data?.message || 'เกิดข้อผิดพลาดในการลบผู้ใช้',
|
||||
position: 'top'
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue