update deps, added logout clear store
This commit is contained in:
parent
3c5aa92840
commit
95d86161ec
12
package.json
12
package.json
|
@ -3,19 +3,19 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.16.2",
|
"axios": "^0.17.1",
|
||||||
"localStorage": "^1.0.3",
|
"localStorage": "^1.0.3",
|
||||||
"react": "^15.6.1",
|
"react": "^16.2.0",
|
||||||
"react-color": "^2.13.8",
|
"react-color": "^2.13.8",
|
||||||
"react-dom": "^15.6.1",
|
"react-dom": "^16.2.0",
|
||||||
"react-redux": "^5.0.6",
|
"react-redux": "^5.0.6",
|
||||||
"react-router": "^4.2.0",
|
"react-router": "^4.2.0",
|
||||||
"react-router-dom": "^4.2.2",
|
"react-router-dom": "^4.2.2",
|
||||||
"react-scripts": "1.0.12",
|
"react-scripts": "1.1.0",
|
||||||
"redux": "^3.7.2",
|
"redux": "^3.7.2",
|
||||||
"redux-logger": "^3.0.6",
|
"redux-logger": "^3.0.6",
|
||||||
"redux-saga": "^0.15.6",
|
"redux-saga": "^0.16.0",
|
||||||
"semantic-ui-react": "^0.72.0"
|
"semantic-ui-react": "^0.77.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
|
|
|
@ -9,7 +9,8 @@ import {
|
||||||
SET_FORM_PASSWORD,
|
SET_FORM_PASSWORD,
|
||||||
SET_FORM_PASSWORD_CONFIRMATION,
|
SET_FORM_PASSWORD_CONFIRMATION,
|
||||||
SET_FORM_EMAIL_VERIFICATION,
|
SET_FORM_EMAIL_VERIFICATION,
|
||||||
SET_FORM_OLD_PASSWORD
|
SET_FORM_OLD_PASSWORD,
|
||||||
|
SET_CLEAR_AUTH_STATE
|
||||||
} from "../../constants/auth.constants";
|
} from "../../constants/auth.constants";
|
||||||
import { parseError } from "../common.actions";
|
import { parseError } from "../common.actions";
|
||||||
|
|
||||||
|
@ -137,3 +138,9 @@ export function setFormOldPassword(oldPassword) {
|
||||||
data: oldPassword
|
data: oldPassword
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function setClearAuthState() {
|
||||||
|
return {
|
||||||
|
type: SET_CLEAR_AUTH_STATE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ import {
|
||||||
SET_FORM_PHONE_NUMBER,
|
SET_FORM_PHONE_NUMBER,
|
||||||
SET_FORM_BUSINESS_NUMBER,
|
SET_FORM_BUSINESS_NUMBER,
|
||||||
SET_FORM_SOCIAL_INSURANCE_NUMBER,
|
SET_FORM_SOCIAL_INSURANCE_NUMBER,
|
||||||
SET_EDIT_PROFILE_TAB_ACTIVE_INDEX
|
SET_EDIT_PROFILE_TAB_ACTIVE_INDEX,
|
||||||
|
SET_CLEAR_USER_STATE
|
||||||
} from "../../constants/user.constants";
|
} from "../../constants/user.constants";
|
||||||
import { parseError } from "../common.actions";
|
import { parseError } from "../common.actions";
|
||||||
|
|
||||||
|
@ -102,3 +103,9 @@ export function setEditProfileTabActiveIndex(indexVal) {
|
||||||
data: indexVal
|
data: indexVal
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function setClearUserState() {
|
||||||
|
return {
|
||||||
|
type: SET_CLEAR_USER_STATE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ import {
|
||||||
CLEAR_WORKTYPE_REQUEST_SUCCESS,
|
CLEAR_WORKTYPE_REQUEST_SUCCESS,
|
||||||
SET_WORKTYPE_UUID,
|
SET_WORKTYPE_UUID,
|
||||||
SET_FORM_WORKTYPE_COLOR,
|
SET_FORM_WORKTYPE_COLOR,
|
||||||
SET_FORM_WORKTYPE_LABEL
|
SET_FORM_WORKTYPE_LABEL,
|
||||||
|
SET_CLEAR_WORKTYPE_STATE
|
||||||
} from "../../constants/worktype.constants";
|
} from "../../constants/worktype.constants";
|
||||||
import { parseError } from "../common.actions";
|
import { parseError } from "../common.actions";
|
||||||
|
|
||||||
|
@ -72,3 +73,9 @@ export function setFormWorktypeLabel(label) {
|
||||||
data: label
|
data: label
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function setClearWorktypeState() {
|
||||||
|
return {
|
||||||
|
type: SET_CLEAR_WORKTYPE_STATE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Container, Form, Header, Message } from "semantic-ui-react";
|
import { Container, Form, Header, Input, Message } from "semantic-ui-react";
|
||||||
|
|
||||||
import Error from "../Shared/Error";
|
import Error from "../Shared/Error";
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@ const UserInfoFormView = ({
|
||||||
>
|
>
|
||||||
<Form.Field>
|
<Form.Field>
|
||||||
<label>Phone Number</label>
|
<label>Phone Number</label>
|
||||||
<input
|
<Input
|
||||||
placeholder="7809999999"
|
placeholder="7809999999"
|
||||||
type="tel"
|
type="tel"
|
||||||
value={phoneNumber}
|
value={phoneNumber || ""}
|
||||||
onChange={changePhoneNumber}
|
onChange={changePhoneNumber}
|
||||||
/>
|
/>
|
||||||
</Form.Field>
|
</Form.Field>
|
||||||
|
|
|
@ -10,6 +10,7 @@ export const SET_FORM_PASSWORD = "SET_FORM_PASSWORD";
|
||||||
export const SET_FORM_PASSWORD_CONFIRMATION = "SET_FORM_PASSWORD_CONFIRMATION";
|
export const SET_FORM_PASSWORD_CONFIRMATION = "SET_FORM_PASSWORD_CONFIRMATION";
|
||||||
export const SET_FORM_EMAIL_VERIFICATION = "SET_FORM_EMAIL_VERIFICATION";
|
export const SET_FORM_EMAIL_VERIFICATION = "SET_FORM_EMAIL_VERIFICATION";
|
||||||
export const SET_FORM_OLD_PASSWORD = "SET_FORM_OLD_PASSWORD";
|
export const SET_FORM_OLD_PASSWORD = "SET_FORM_OLD_PASSWORD";
|
||||||
|
export const SET_CLEAR_AUTH_STATE = "SET_CLEAR_AUTH_STATE";
|
||||||
|
|
||||||
// Saga Auth Action Constants
|
// Saga Auth Action Constants
|
||||||
export const SEND_REGISTER_REQUEST = "SEND_REGISTER_REQUEST";
|
export const SEND_REGISTER_REQUEST = "SEND_REGISTER_REQUEST";
|
||||||
|
|
|
@ -14,6 +14,7 @@ export const SET_FORM_SOCIAL_INSURANCE_NUMBER =
|
||||||
"SET_FORM_SOCIAL_INSURANCE_NUMBER";
|
"SET_FORM_SOCIAL_INSURANCE_NUMBER";
|
||||||
export const SET_EDIT_PROFILE_TAB_ACTIVE_INDEX =
|
export const SET_EDIT_PROFILE_TAB_ACTIVE_INDEX =
|
||||||
"SET_EDIT_PROFILE_TAB_ACTIVE_INDEX";
|
"SET_EDIT_PROFILE_TAB_ACTIVE_INDEX";
|
||||||
|
export const SET_CLEAR_USER_STATE = "SET_CLEAR_USER_STATE";
|
||||||
|
|
||||||
// Saga User Action Constants
|
// Saga User Action Constants
|
||||||
export const GET_SELF_USER_REQUEST = "GET_SELF_USER_REQUEST";
|
export const GET_SELF_USER_REQUEST = "GET_SELF_USER_REQUEST";
|
||||||
|
|
|
@ -7,6 +7,7 @@ export const CLEAR_WORKTYPE_REQUEST_SUCCESS = "CLEAR_WORKTYPE_REQUEST_SUCCESS";
|
||||||
export const SET_WORKTYPE_UUID = "SET_WORKTYPE_UUID";
|
export const SET_WORKTYPE_UUID = "SET_WORKTYPE_UUID";
|
||||||
export const SET_FORM_WORKTYPE_LABEL = "SET_FORM_WORKTYPE_LABEL";
|
export const SET_FORM_WORKTYPE_LABEL = "SET_FORM_WORKTYPE_LABEL";
|
||||||
export const SET_FORM_WORKTYPE_COLOR = "SET_FORM_WORKTYPE_COLOR";
|
export const SET_FORM_WORKTYPE_COLOR = "SET_FORM_WORKTYPE_COLOR";
|
||||||
|
export const SET_CLEAR_WORKTYPE_STATE = "SET_CLEAR_WORKTYPE_STATE";
|
||||||
|
|
||||||
// Saga Worktype Action Constants
|
// Saga Worktype Action Constants
|
||||||
export const CREATE_WORKTYPE_REQUEST = "CREATE_WORKTYPE_REQUEST";
|
export const CREATE_WORKTYPE_REQUEST = "CREATE_WORKTYPE_REQUEST";
|
||||||
|
|
|
@ -9,12 +9,13 @@ import {
|
||||||
SET_FORM_PASSWORD,
|
SET_FORM_PASSWORD,
|
||||||
SET_FORM_PASSWORD_CONFIRMATION,
|
SET_FORM_PASSWORD_CONFIRMATION,
|
||||||
SET_FORM_EMAIL_VERIFICATION,
|
SET_FORM_EMAIL_VERIFICATION,
|
||||||
SET_FORM_OLD_PASSWORD
|
SET_FORM_OLD_PASSWORD,
|
||||||
|
SET_CLEAR_AUTH_STATE
|
||||||
} from "../constants/auth.constants";
|
} from "../constants/auth.constants";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the user's auth token, and return the value
|
* Set the user's auth token, and return the value
|
||||||
* @param {string} newToken
|
* @param {string} newToken
|
||||||
*/
|
*/
|
||||||
function me(newToken) {
|
function me(newToken) {
|
||||||
if (typeof newToken === "string") {
|
if (typeof newToken === "string") {
|
||||||
|
@ -92,7 +93,11 @@ function authReducer(state = initialState, action) {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
oldPassword: action.data
|
oldPassword: action.data
|
||||||
}
|
};
|
||||||
|
case SET_CLEAR_AUTH_STATE:
|
||||||
|
return {
|
||||||
|
...initialState
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
SET_FORM_BUSINESS_NUMBER,
|
SET_FORM_BUSINESS_NUMBER,
|
||||||
SET_FORM_SOCIAL_INSURANCE_NUMBER,
|
SET_FORM_SOCIAL_INSURANCE_NUMBER,
|
||||||
SET_EDIT_PROFILE_TAB_ACTIVE_INDEX,
|
SET_EDIT_PROFILE_TAB_ACTIVE_INDEX,
|
||||||
|
SET_CLEAR_USER_STATE,
|
||||||
USER_INFO_STEP,
|
USER_INFO_STEP,
|
||||||
CLIENT
|
CLIENT
|
||||||
} from "../constants/user.constants";
|
} from "../constants/user.constants";
|
||||||
|
@ -95,6 +96,10 @@ function userReducer(state = initialState, action) {
|
||||||
...state,
|
...state,
|
||||||
editProfileActiveIndex: action.data
|
editProfileActiveIndex: action.data
|
||||||
};
|
};
|
||||||
|
case SET_CLEAR_USER_STATE:
|
||||||
|
return {
|
||||||
|
...initialState
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ import {
|
||||||
CLEAR_WORKTYPE_REQUEST_SUCCESS,
|
CLEAR_WORKTYPE_REQUEST_SUCCESS,
|
||||||
SET_WORKTYPE_UUID,
|
SET_WORKTYPE_UUID,
|
||||||
SET_FORM_WORKTYPE_COLOR,
|
SET_FORM_WORKTYPE_COLOR,
|
||||||
SET_FORM_WORKTYPE_LABEL
|
SET_FORM_WORKTYPE_LABEL,
|
||||||
|
SET_CLEAR_WORKTYPE_STATE
|
||||||
} from "../constants/worktype.constants";
|
} from "../constants/worktype.constants";
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
|
@ -60,6 +61,10 @@ function worktypeReducer(state = initialState, action) {
|
||||||
...state,
|
...state,
|
||||||
label: action.data
|
label: action.data
|
||||||
};
|
};
|
||||||
|
case SET_CLEAR_WORKTYPE_STATE:
|
||||||
|
return {
|
||||||
|
...initialState
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,14 @@ import {
|
||||||
setFormEmail,
|
setFormEmail,
|
||||||
setFormPassword,
|
setFormPassword,
|
||||||
setFormPasswordConfirmation,
|
setFormPasswordConfirmation,
|
||||||
setFormOldPassword
|
setFormOldPassword,
|
||||||
|
setClearAuthState
|
||||||
} from "../actions/auth/reducer.actions";
|
} from "../actions/auth/reducer.actions";
|
||||||
import { setSelfUser } from "../actions/user/reducer.actions";
|
import {
|
||||||
|
setSelfUser,
|
||||||
|
setClearUserState
|
||||||
|
} from "../actions/user/reducer.actions";
|
||||||
|
import { setClearWorktypeState } from "../actions/worktype/reducer.actions";
|
||||||
import {
|
import {
|
||||||
registerUser,
|
registerUser,
|
||||||
verifyEmail,
|
verifyEmail,
|
||||||
|
@ -62,6 +67,9 @@ function* loginUserCall(postBody) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function* logoutUserCall() {
|
function* logoutUserCall() {
|
||||||
|
yield effects.put(setClearAuthState());
|
||||||
|
yield effects.put(setClearUserState());
|
||||||
|
yield effects.put(setClearWorktypeState());
|
||||||
yield effects.call(logoutUser);
|
yield effects.call(logoutUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,15 @@ import {
|
||||||
} from "../actions/user/reducer.actions";
|
} from "../actions/user/reducer.actions";
|
||||||
import { getSelfUserRequest } from "../actions/user/saga.actions";
|
import { getSelfUserRequest } from "../actions/user/saga.actions";
|
||||||
import { CLIENT_OR_PROVIDER_STEP } from "../constants/user.constants";
|
import { CLIENT_OR_PROVIDER_STEP } from "../constants/user.constants";
|
||||||
import { getSelfUser, createUserInfo, updateUserInfo, createClient, updateClient, createProvider, updateProvider } from "../api/user.api";
|
import {
|
||||||
|
getSelfUser,
|
||||||
|
createUserInfo,
|
||||||
|
updateUserInfo,
|
||||||
|
createClient,
|
||||||
|
updateClient,
|
||||||
|
createProvider,
|
||||||
|
updateProvider
|
||||||
|
} from "../api/user.api";
|
||||||
|
|
||||||
function* getSelfUserCall() {
|
function* getSelfUserCall() {
|
||||||
yield effects.put(isSendingUserRequest(true));
|
yield effects.put(isSendingUserRequest(true));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user