|
|
|
|
@ -204,6 +204,9 @@ const Admin = (props: Props) => {
|
|
|
|
|
const onChangeRole = async (e: React.ChangeEvent<HTMLSelectElement>, user: User) => {
|
|
|
|
|
const body = { selectedUserEmail: user.email, selectedUserRole: e.target.value }
|
|
|
|
|
fetcher('/api/user/update', 'PUT', body)
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
router.refresh();
|
|
|
|
|
}, 2000)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const onDeleteUser = async (userEmail: string) => {
|
|
|
|
|
@ -366,7 +369,6 @@ const Admin = (props: Props) => {
|
|
|
|
|
<option value="SELLER">Vendeur</option>
|
|
|
|
|
<option value="ADMIN">Administrateur</option>
|
|
|
|
|
{isSuperAdmin && <option value="SUPERADMIN">SuperAdmin</option>}
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
</td>}
|
|
|
|
|
{info.role !== Role.SELLER && <td><button className="btn btn-primary" onClick={() => onDeleteUser(info.email)}>Supprimer</button></td>}
|
|
|
|
|
|