lavoce #2
@@ -11,7 +11,7 @@ import {
|
|||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { NotifAlert, NotifOk, NotifConfirmDialog } from '../../../components/Global/ToastNotif';
|
import { NotifAlert, NotifOk, NotifConfirmDialog } from '../../../components/Global/ToastNotif';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { deleteUser, getAllUser } from '../../../api/user';
|
import { deleteUser, getAllUser, approveUser } from '../../../api/user';
|
||||||
import TableList from '../../../components/Global/TableList';
|
import TableList from '../../../components/Global/TableList';
|
||||||
|
|
||||||
const columns = (showPreviewModal, showEditModal, showDeleteDialog, showApproveDialog) => [
|
const columns = (showPreviewModal, showEditModal, showDeleteDialog, showApproveDialog) => [
|
||||||
@@ -24,20 +24,20 @@ const columns = (showPreviewModal, showEditModal, showDeleteDialog, showApproveD
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Username',
|
title: 'Username',
|
||||||
dataIndex: 'username',
|
dataIndex: 'user_name',
|
||||||
key: 'username',
|
key: 'user_name',
|
||||||
width: '12%',
|
width: '12%',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Nama Lengkap',
|
title: 'Nama Lengkap',
|
||||||
dataIndex: 'fullname',
|
dataIndex: 'user_fullname',
|
||||||
key: 'fullname',
|
key: 'user_fullname',
|
||||||
width: '15%',
|
width: '15%',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Nomor WA',
|
title: 'Nomor WA',
|
||||||
dataIndex: 'whatsapp_number',
|
dataIndex: 'user_phone',
|
||||||
key: 'whatsapp_number',
|
key: 'user_phone',
|
||||||
width: '12%',
|
width: '12%',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -159,12 +159,10 @@ const ListUser = memo(function ListUser(props) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const token = localStorage.getItem('token');
|
const token = localStorage.getItem('token');
|
||||||
if (token) {
|
if (token && props.actionMode == 'list') {
|
||||||
if (props.actionMode == 'list') {
|
|
||||||
setFormDataFilter(defaultFilter);
|
setFormDataFilter(defaultFilter);
|
||||||
doFilter();
|
doFilter();
|
||||||
}
|
} else if (!token) {
|
||||||
} else {
|
|
||||||
navigate('/signin');
|
navigate('/signin');
|
||||||
}
|
}
|
||||||
}, [props.actionMode]);
|
}, [props.actionMode]);
|
||||||
@@ -225,21 +223,21 @@ const ListUser = memo(function ListUser(props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleApprove = async (user_id) => {
|
const handleApprove = async (user_id) => {
|
||||||
// TODO: Implement approve user API call
|
const response = await approveUser(user_id);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
NotifAlert({
|
NotifAlert({
|
||||||
icon: 'info',
|
icon: 'success',
|
||||||
title: 'Info',
|
title: 'Berhasil',
|
||||||
message: 'Approve user akan diimplementasikan dengan API',
|
message: 'User berhasil diapprove.',
|
||||||
});
|
});
|
||||||
// const response = await approveUser(user_id);
|
doFilter();
|
||||||
// if (response.statusCode == 200) {
|
} else {
|
||||||
// NotifAlert({
|
NotifOk({
|
||||||
// icon: 'success',
|
icon: 'error',
|
||||||
// title: 'Berhasil',
|
title: 'Gagal',
|
||||||
// message: 'User berhasil diapprove.',
|
message: 'Gagal Approve User',
|
||||||
// });
|
});
|
||||||
// doFilter();
|
}
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDelete = async (user_id) => {
|
const handleDelete = async (user_id) => {
|
||||||
@@ -249,7 +247,7 @@ const ListUser = memo(function ListUser(props) {
|
|||||||
NotifAlert({
|
NotifAlert({
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
title: 'Berhasil',
|
title: 'Berhasil',
|
||||||
message: 'User "' + response.data.fullname + '" berhasil dihapus.',
|
message: 'User "' + response.data.user_fullname + '" berhasil dihapus.',
|
||||||
});
|
});
|
||||||
doFilter();
|
doFilter();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user