Fakultas Ilmu Komputer UI

Commit 49936b3b authored by jahnsmichael's avatar jahnsmichael
Browse files

[GREEN] new fetch services for edit profile

parent 330a75d8
......@@ -12,6 +12,7 @@ const END_POINTS = {
LOGS: createEndpoint(["logs"]),
LOGIN: '/auth/token/',
FORGET_PASSWORD: '/accounts/set_random_password/',
EDIT_PROFILE: '/accounts/update_profile/',
};
enum Method {
......@@ -93,6 +94,21 @@ export default function useMainService(token: string) {
return fetchWithoutAuthentication(endPoint, Method.POST, body);
}
interface EditProfileFormType {
new_name: string;
new_username: string;
new_password: string;
confirm_new_password: string;
new_email: string;
new_phone_number: string;
new_district: string;
new_sub_district: string;
}
async function editProfile(body: EditProfileFormType) {
return fetchWithAuthentication(END_POINTS.EDIT_PROFILE, Method.PUT, body);
}
async function createCaseSubject(body: object) {
const endPoint = END_POINTS.CASE_SUBJECTS([
null,
......@@ -267,6 +283,7 @@ export default function useMainService(token: string) {
forgetPassword,
createUser,
me,
editProfile,
// Contact Investigation Form
createCaseSubject,
createInvestigationCase,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment