fix: edit member
This commit is contained in:
@@ -136,7 +136,10 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
||||
where: {
|
||||
nik: data.nik,
|
||||
email: data.email,
|
||||
phone: data.phone
|
||||
phone: data.phone,
|
||||
NOT: {
|
||||
id: id
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -53,10 +53,6 @@ export const funEditStatusMember = async (path: string, data: IStatusmember) =>
|
||||
|
||||
|
||||
export const funEditMember = async (path: string, data: IEditDataMember) => {
|
||||
|
||||
if (data.name.length < 3)
|
||||
return { success: false, message: 'Minimal 3 karakter' }
|
||||
|
||||
const response = await fetch(`/api/user/${path}`, {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
|
||||
@@ -122,8 +122,12 @@ export default function EditMember({ id }: { id: string }) {
|
||||
idUserRole: data.idUserRole
|
||||
})
|
||||
|
||||
if (res.success) {
|
||||
toast.success(res.message)
|
||||
router.push(`/member?active=true`)
|
||||
} else {
|
||||
toast.error(res.message)
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user