Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
exports[`Login Container Should render 1`] = `
<Login
errorMessage=""
forgotPassword={[Function]}
handleSelectPanel={[Function]}
isLoggedIn={false}
isLoginLoading={false}
Expand Down
3 changes: 3 additions & 0 deletions src/app/actions/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export namespace UserActions {
GET_USER_DETAILS = 'GET_USER_DETAILS',
EDIT_USER_PROFILE = 'EDIT_USER_PROFILE',
EDIT_USER_PASSWORD = 'EDIT_USER_PASSWORD',
FORGOT_PASSWORD = 'FORGOT_PASSWORD',
UPDATE_ERROR_MESSAGE = 'UPDATE_ERROR_MESSAGE',
UPDATE_USER_DETAILS = 'UPDATE_USER_DETAILS',
CHECK_USERNAME_EXISTS = 'CHECK_USERNAME_EXISTS',
Expand Down Expand Up @@ -72,4 +73,6 @@ export namespace UserActions {

export const setIsLoginLoading = (isLoginLoading: boolean) =>
action(Type.SET_IS_LOGIN_LOADING, { isLoginLoading });

export const forgotPassword = (email: string) => action(Type.FORGOT_PASSWORD, { email });
}
21 changes: 21 additions & 0 deletions src/app/apiFetch/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,27 @@ export const userEditPassword = (body: UserInterfaces.EditUserPassword) => {
});
};

export const userForgotPassword = (body: UserInterfaces.ForgotPassword) => {
return fetch(`${API_BASE_URL}user/forgot-password`, {
body: JSON.stringify(body),
credentials: 'include',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
method: 'POST',
})
.then((response) => {
return response.json();
})
.then((data) => {
return data;
})
.catch((error) => {
console.error(error);
});
};

export const userGetDetails = () => {
return fetch(`${API_BASE_URL}user/profile`, {
credentials: 'include',
Expand Down
Loading