feat : update profile
This commit is contained in:
17
src/module/user/profile/lib/api_profile.ts
Normal file
17
src/module/user/profile/lib/api_profile.ts
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user