Adding code for update password api

This commit is contained in:
2026-07-02 22:38:50 -04:00
parent be1238e24d
commit 62ed047a59
+24
View File
@@ -37,4 +37,28 @@ export const userApi = {
throw new Error('Error logging in');
}
},
update_password: async (userId, currentPassword, updatedPassword, confirmedPassword) => {
const request = {
user_id: userId,
current_password: currentPassword,
updated_password: updatedPassword,
confirmed_password: confirmedPassword,
};
const reponse = await fetch(
`${AUTH_API_BASE_URL}/api/v1/user/password/update`,
{
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(request)
}
);
if (reponse.ok) {
return reponse.json();
} else {
throw new Error('Error logging in');
}
},
};