update deps, added logout clear store

This commit is contained in:
Alexander Wong 2018-01-21 12:01:59 -07:00
parent 3c5aa92840
commit 95d86161ec
No known key found for this signature in database
GPG Key ID: EBFE6371FA6A79DC
14 changed files with 984 additions and 821 deletions

View File

@ -3,19 +3,19 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.16.2",
"axios": "^0.17.1",
"localStorage": "^1.0.3",
"react": "^15.6.1",
"react": "^16.2.0",
"react-color": "^2.13.8",
"react-dom": "^15.6.1",
"react-dom": "^16.2.0",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "1.0.12",
"react-scripts": "1.1.0",
"redux": "^3.7.2",
"redux-logger": "^3.0.6",
"redux-saga": "^0.15.6",
"semantic-ui-react": "^0.72.0"
"redux-saga": "^0.16.0",
"semantic-ui-react": "^0.77.2"
},
"scripts": {
"start": "react-scripts start",

View File

@ -9,7 +9,8 @@ import {
SET_FORM_PASSWORD,
SET_FORM_PASSWORD_CONFIRMATION,
SET_FORM_EMAIL_VERIFICATION,
SET_FORM_OLD_PASSWORD
SET_FORM_OLD_PASSWORD,
SET_CLEAR_AUTH_STATE
} from "../../constants/auth.constants";
import { parseError } from "../common.actions";
@ -137,3 +138,9 @@ export function setFormOldPassword(oldPassword) {
data: oldPassword
};
}
export function setClearAuthState() {
return {
type: SET_CLEAR_AUTH_STATE
};
}

View File

@ -10,7 +10,8 @@ import {
SET_FORM_PHONE_NUMBER,
SET_FORM_BUSINESS_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";
import { parseError } from "../common.actions";
@ -102,3 +103,9 @@ export function setEditProfileTabActiveIndex(indexVal) {
data: indexVal
};
}
export function setClearUserState() {
return {
type: SET_CLEAR_USER_STATE
};
}

View File

@ -6,7 +6,8 @@ import {
CLEAR_WORKTYPE_REQUEST_SUCCESS,
SET_WORKTYPE_UUID,
SET_FORM_WORKTYPE_COLOR,
SET_FORM_WORKTYPE_LABEL
SET_FORM_WORKTYPE_LABEL,
SET_CLEAR_WORKTYPE_STATE
} from "../../constants/worktype.constants";
import { parseError } from "../common.actions";
@ -72,3 +73,9 @@ export function setFormWorktypeLabel(label) {
data: label
};
}
export function setClearWorktypeState() {
return {
type: SET_CLEAR_WORKTYPE_STATE
};
}

View File

@ -1,5 +1,5 @@
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";
@ -21,10 +21,10 @@ const UserInfoFormView = ({
>
<Form.Field>
<label>Phone Number</label>
<input
<Input
placeholder="7809999999"
type="tel"
value={phoneNumber}
value={phoneNumber || ""}
onChange={changePhoneNumber}
/>
</Form.Field>

View File

@ -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_EMAIL_VERIFICATION = "SET_FORM_EMAIL_VERIFICATION";
export const SET_FORM_OLD_PASSWORD = "SET_FORM_OLD_PASSWORD";
export const SET_CLEAR_AUTH_STATE = "SET_CLEAR_AUTH_STATE";
// Saga Auth Action Constants
export const SEND_REGISTER_REQUEST = "SEND_REGISTER_REQUEST";

View File

@ -14,6 +14,7 @@ export const SET_FORM_SOCIAL_INSURANCE_NUMBER =
"SET_FORM_SOCIAL_INSURANCE_NUMBER";
export const 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
export const GET_SELF_USER_REQUEST = "GET_SELF_USER_REQUEST";

View File

@ -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_FORM_WORKTYPE_LABEL = "SET_FORM_WORKTYPE_LABEL";
export const SET_FORM_WORKTYPE_COLOR = "SET_FORM_WORKTYPE_COLOR";
export const SET_CLEAR_WORKTYPE_STATE = "SET_CLEAR_WORKTYPE_STATE";
// Saga Worktype Action Constants
export const CREATE_WORKTYPE_REQUEST = "CREATE_WORKTYPE_REQUEST";

View File

@ -9,7 +9,8 @@ import {
SET_FORM_PASSWORD,
SET_FORM_PASSWORD_CONFIRMATION,
SET_FORM_EMAIL_VERIFICATION,
SET_FORM_OLD_PASSWORD
SET_FORM_OLD_PASSWORD,
SET_CLEAR_AUTH_STATE
} from "../constants/auth.constants";
/**
@ -92,7 +93,11 @@ function authReducer(state = initialState, action) {
return {
...state,
oldPassword: action.data
}
};
case SET_CLEAR_AUTH_STATE:
return {
...initialState
};
default:
return state;
}

View File

@ -11,6 +11,7 @@ import {
SET_FORM_BUSINESS_NUMBER,
SET_FORM_SOCIAL_INSURANCE_NUMBER,
SET_EDIT_PROFILE_TAB_ACTIVE_INDEX,
SET_CLEAR_USER_STATE,
USER_INFO_STEP,
CLIENT
} from "../constants/user.constants";
@ -95,6 +96,10 @@ function userReducer(state = initialState, action) {
...state,
editProfileActiveIndex: action.data
};
case SET_CLEAR_USER_STATE:
return {
...initialState
};
default:
return state;
}

View File

@ -6,7 +6,8 @@ import {
CLEAR_WORKTYPE_REQUEST_SUCCESS,
SET_WORKTYPE_UUID,
SET_FORM_WORKTYPE_COLOR,
SET_FORM_WORKTYPE_LABEL
SET_FORM_WORKTYPE_LABEL,
SET_CLEAR_WORKTYPE_STATE
} from "../constants/worktype.constants";
const initialState = {
@ -60,6 +61,10 @@ function worktypeReducer(state = initialState, action) {
...state,
label: action.data
};
case SET_CLEAR_WORKTYPE_STATE:
return {
...initialState
};
default:
return state;
}

View File

@ -9,9 +9,14 @@ import {
setFormEmail,
setFormPassword,
setFormPasswordConfirmation,
setFormOldPassword
setFormOldPassword,
setClearAuthState
} 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 {
registerUser,
verifyEmail,
@ -62,6 +67,9 @@ function* loginUserCall(postBody) {
}
function* logoutUserCall() {
yield effects.put(setClearAuthState());
yield effects.put(setClearUserState());
yield effects.put(setClearWorktypeState());
yield effects.call(logoutUser);
}

View File

@ -11,7 +11,15 @@ import {
} from "../actions/user/reducer.actions";
import { getSelfUserRequest } from "../actions/user/saga.actions";
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() {
yield effects.put(isSendingUserRequest(true));

1712
yarn.lock

File diff suppressed because it is too large Load Diff