upd: member
Deskripsi: - pembatasan user role - tambah member - detail member - upload image member No Issues
This commit is contained in:
@@ -5,7 +5,7 @@ export const funGetAllmember = async (path?: string) => {
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
export const funGetRoleUser= async (path?: string) => {
|
||||
export const funGetRoleUser = async (path?: string) => {
|
||||
const response = await fetch(`/api/role-user${(path) ? path : ''}`, { next: { tags: ['member'] } });
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
@@ -15,25 +15,10 @@ export const funGetOneMember = async (path: string) => {
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
export const funCreateMember = async (data: IFormMember) => {
|
||||
|
||||
if (data.name.length < 3)
|
||||
return { success: false, message: 'Name minimal 3 karakter' }
|
||||
if (data.email.length < 3)
|
||||
return { success: false, message: 'Email minimal 3 karakter' }
|
||||
|
||||
if (data.phone.length < 10)
|
||||
return { success: false, message: 'Phone minimal 10 karakter' }
|
||||
|
||||
if (data.nik.length < 16)
|
||||
return { success: false, message: 'NIK harus 16 karakter' }
|
||||
|
||||
export const funCreateMember = async (data: FormData) => {
|
||||
const response = await fetch("/api/user", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
body: data,
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user