feat : update profile

This commit is contained in:
lukman
2024-08-28 14:32:00 +08:00
parent 0d16adbd2f
commit d88e42e8a8
17 changed files with 660 additions and 179 deletions

View File

@@ -0,0 +1,17 @@
import { IEditDataProfile } from "./type_profile";
export const funGetProfileByCookies = async (path?: string) => {
const response = await fetch(`/api/user/profile${(path) ? path : ''}`, { next: { tags: ['profile'] } });
return await response.json().catch(() => null);
}
export const funEditProfileByCookies = async ( data: IEditDataProfile) => {
const response = await fetch(`/api/user/profile/`, {
method: "PUT",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
return await response.json().catch(() => null);
}

View File

@@ -0,0 +1,21 @@
export interface IProfileById {
id: string
name: string
email: string
phone: string
nik: string
gender: string
idGroup: string
idPosition: string
group: string
position: string
}
export interface IEditDataProfile {
id: string;
nik: string;
name: string;
phone: string;
email: string;
gender: string;
}