Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
- add missing api functions #1878
Browse files Browse the repository at this point in the history
- properly get the token from params #1878
  • Loading branch information
siemiatj committed Jul 21, 2018
1 parent 30e6d3c commit 2526393
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import {
loginCompletionRequest,
logoutRequest,
resetPasswordRequest,
getResetPasswordInfo,
resetPasswordComplete,
resetPasswordGetAvatar,
getAvatar,
getUserSession,
getUserLang,
Expand All @@ -38,6 +41,9 @@ export {
loginCompletionRequest,
logoutRequest,
resetPasswordRequest,
getResetPasswordInfo,
resetPasswordComplete,
resetPasswordGetAvatar,
getAvatar,
getUserSession,
getUserLang,
Expand Down
13 changes: 12 additions & 1 deletion src/api/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,19 @@ export function getUserSession() {
}

export function resetPasswordRequest(form) {
console.log('resetPassword form: ', form)
return axios.post(`${config.API_URL}/login/resetPassword`, {
...form,
});
}

export function getResetPasswordInfo(token) {
return axios.get(`${config.API_URL}/login/resetPassword/${token}`);
}

export function resetPasswordComplete(token) {
return axios.post(`${config.API_URL}/login/resetPassword/${token}`);
}

export function resetPasswordGetAvatar(token) {
return axios.get(`${config.API_URL}/login/resetPassword/${token}/avatar`);
}
14 changes: 7 additions & 7 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ export const getRoutes = (store, auth, plugins) => {
)}
/>
<Route
path="/resetPassword/:token"
component={(nextState) => {
console.log('RESET PASSWORD: ', nextState)
return (<Login
splat={nextState.location.pathname.replace('/', '')}
/>);
}}
path="/resetPassword"
component={({ location }) => (
<Login
splat={location.pathname.replace('/', '')}
token={location.query.token}
/>
)}
/>
<Route path="*" component={NoMatch} />
</Route>
Expand Down

0 comments on commit 2526393

Please sign in to comment.