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

Commit

Permalink
- change routes and some renaming #1878
Browse files Browse the repository at this point in the history
  • Loading branch information
siemiatj committed Aug 7, 2018
1 parent fa5b1fb commit 81f5e19
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
localLoginRequest,
loginCompletionRequest,
logoutRequest,
resetPasswordRequest,
getAvatar,
getUserSession,
getUserLang,
Expand All @@ -36,6 +37,7 @@ export {
localLoginRequest,
loginCompletionRequest,
logoutRequest,
resetPasswordRequest,
getAvatar,
getUserSession,
getUserLang,
Expand Down
4 changes: 2 additions & 2 deletions src/api/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export function getUserSession() {
return axios.get(`${config.API_URL}/userSession`);
}

export function resetPassword(form) {
export function resetPasswordRequest(form) {
console.log('resetPassword form: ', form)
return axios.post(`${config.API_URL}/login/resetPassword`, {
...form
...form,
});
}
2 changes: 1 addition & 1 deletion src/components/app/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class LoginForm extends Component {

handleForgotPassword = () => {
const { dispatch } = this.props;
dispatch(push('/login/forgottenPassword'));
dispatch(push('/forgottenPassword'));
};

openDropdown = () => {
Expand Down
26 changes: 19 additions & 7 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,30 @@ export const getRoutes = (store, auth, plugins) => {
<IndexRoute component={Dashboard} />
</Route>
<Route
path="/login*"
component={({ location, routeParams }) => {
console.log('NEXTSTATE: ', location, routeParams)
return (<Login
splat={routeParams.splat.replace('/', '')}
path="/login"
component={({ location }) => (
<Login
redirect={location.query.redirect}
logged={localStorage.isLogged}
{...{ auth }}
/>
)}
/>
<Route
path="/forgottenPassword"
component={({ location }) => (
<Login splat={location.pathname.replace('/', '')} />
)}
/>
<Route
path="/resetPassword/:token"
component={(nextState) => {
console.log('RESET PASSWORD: ', nextState)
return (<Login
splat={nextState.location.pathname.replace('/', '')}
/>);
}}
>
</Route>
/>
<Route path="*" component={NoMatch} />
</Route>
);
Expand Down

0 comments on commit 81f5e19

Please sign in to comment.