Merge pull request 'sua lai xoa quyen' (#11) from feature/login-role into dev
Reviewed-on: huyt/fsi_project#11
This commit is contained in:
commit
1da6cf4a85
|
@ -26,7 +26,7 @@ const ModalUser = (props) => {
|
||||||
const [birthday, setBirthday] = useState(moment())
|
const [birthday, setBirthday] = useState(moment())
|
||||||
const [crrData, setCrrData] = useState(null);
|
const [crrData, setCrrData] = useState(null);
|
||||||
|
|
||||||
const [selectedRole, setSelectedRole] = useState([])
|
const [selectedRole, setSelectedRole] = useState("")
|
||||||
const [active, setActive] = useState(false)
|
const [active, setActive] = useState(false)
|
||||||
|
|
||||||
const [checkDeleteMulti, setCheckDeleteMulti] = useState(false);
|
const [checkDeleteMulti, setCheckDeleteMulti] = useState(false);
|
||||||
|
|
|
@ -87,19 +87,12 @@ class Role extends Component {
|
||||||
|
|
||||||
|
|
||||||
DeleteRole = async (Role) => {
|
DeleteRole = async (Role) => {
|
||||||
if (Role.is_default === 1) {
|
let data = await fetch(`${HOST}/api/roles/${Role._id}`, {
|
||||||
swal("Cảnh báo", "Bạn không được xóa quyền mặc định", "warning");
|
method: 'DELETE',
|
||||||
return;
|
|
||||||
}
|
|
||||||
let data = await fetch(`${HOST}/api/role/delete`, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
// 'Authorization': token,
|
// 'Authorization': token,
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
|
||||||
'id': Role.id
|
|
||||||
})
|
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
return response.json()
|
return response.json()
|
||||||
});
|
});
|
||||||
|
@ -181,7 +174,7 @@ class Role extends Component {
|
||||||
v.preventDefault();
|
v.preventDefault();
|
||||||
swal({
|
swal({
|
||||||
title: "Bạn có chắc chắn?",
|
title: "Bạn có chắc chắn?",
|
||||||
text: "Bạn có chắc chắn muốn xóa quyền" + e.name,
|
text: "Bạn có chắc chắn muốn xóa quyền " + e.name,
|
||||||
icon: "warning",
|
icon: "warning",
|
||||||
buttons: true,
|
buttons: true,
|
||||||
dangerMode: true,
|
dangerMode: true,
|
||||||
|
|
|
@ -304,7 +304,7 @@ export default function User() {
|
||||||
gender: "1",
|
gender: "1",
|
||||||
is_deleted: 0,
|
is_deleted: 0,
|
||||||
phone_number: "",
|
phone_number: "",
|
||||||
level_obj_id: [],
|
level_obj_id: "",
|
||||||
username: ""
|
username: ""
|
||||||
}
|
}
|
||||||
setDataEdit(defaultData)
|
setDataEdit(defaultData)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user