signup
This commit is contained in:
parent
6828e32f9c
commit
22eaf7e5c2
|
@ -2,6 +2,8 @@ import { ReducersMapObject } from 'redux';
|
|||
import SagaWatcher from '@overflow/commons/redux/saga/SagaWatcher';
|
||||
|
||||
import signInReducer from '@overflow/member/redux/reducer/signIn';
|
||||
import signUpReducer from '@overflow/member/redux/reducer/signUp';
|
||||
|
||||
import readAllProbeReducer from '@overflow/probe/redux/reducer/readAllByDomain';
|
||||
import readProbeReducer from '@overflow/probe/redux/reducer/read';
|
||||
|
||||
|
@ -47,6 +49,7 @@ const reduxConfig: ReduxConfig = {
|
|||
readProbeReducer,
|
||||
readAllByTargetReducer,
|
||||
SensorReadReducer,
|
||||
signUpReducer,
|
||||
],
|
||||
sagaWatchers: [
|
||||
AsyncRequest,
|
||||
|
|
|
@ -5,6 +5,7 @@ import MetaMemberStatus from '@overflow/meta/api/model/MetaMemberStatus';
|
|||
interface Member {
|
||||
id?: number;
|
||||
email?: string;
|
||||
pw?:string;
|
||||
name?: string;
|
||||
phone?: string;
|
||||
companyName?: string;
|
||||
|
|
|
@ -8,19 +8,21 @@ import {
|
|||
} from './components/SignUp';
|
||||
import State from '../redux/state/SignUp';
|
||||
|
||||
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
||||
|
||||
import * as signupActions from '../redux/action/signUp';
|
||||
|
||||
|
||||
export function mapStateToProps(state: any): SignUpStateProps {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
export function mapDispatchToProps(dispatch: Dispatch<any>): SignUpDispatchProps {
|
||||
return {
|
||||
onSignUp: (member: Member) => {
|
||||
dispatch(signupActions.request(member));
|
||||
dispatch(asyncRequestActions.request('MemberService', 'signup', signupActions.REQUEST, JSON.stringify(member)));
|
||||
// dispatch(signupActions.request(member));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
Form,
|
||||
ButtonProps,
|
||||
} from 'semantic-ui-react';
|
||||
import MemberStatus from '../../api/model/MemberStatus';
|
||||
|
||||
export interface StateProps {
|
||||
}
|
||||
|
@ -99,9 +100,22 @@ export class SignUp extends React.Component<Props, State> {
|
|||
);
|
||||
}
|
||||
|
||||
private signUpClick(event: React.SyntheticEvent<HTMLButtonElement>, data: ButtonProps):void {
|
||||
private signUpClick = (event: React.SyntheticEvent<HTMLButtonElement>, data: ButtonProps):void => {
|
||||
|
||||
// this.props.onSignUp(member);
|
||||
let member:Member = {};
|
||||
member.pw = this.state.pass;
|
||||
|
||||
if (member.pw !== this.state.passCon) {
|
||||
return;
|
||||
}
|
||||
|
||||
member.email = this.state.email;
|
||||
member.name = this.state.name;
|
||||
member.companyName = this.state.company;
|
||||
member.phone = this.state.phone;
|
||||
// member.status = MemberStatus.NOAUTH;
|
||||
|
||||
this.props.onSignUp(member);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,39 +1,8 @@
|
|||
import Action from '@overflow/commons/redux/Action';
|
||||
import Member from '@overflow/member/api/model/Member';
|
||||
|
||||
import SigninPayload from '../payload/SignInPayload';
|
||||
|
||||
// Action Type
|
||||
export type REQUEST = '@overflow/member/signup/REQUEST';
|
||||
export type REQUEST_SUCCESS = '@overflow/member/signup/REQUEST_SUCCESS';
|
||||
export type REQUEST_FAILURE = '@overflow/member/signup/REQUEST_FAILURE';
|
||||
export type REQUEST_SUCCESS = '@overflow/member/signup/REQUEST/SUCCESS';
|
||||
export type REQUEST_FAILURE = '@overflow/member/signup/REQUEST/FAILURE';
|
||||
|
||||
export const REQUEST: REQUEST = '@overflow/member/signup/REQUEST';
|
||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/signup/REQUEST_SUCCESS';
|
||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/signup/REQUEST_FAILURE';
|
||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/signup/REQUEST/SUCCESS';
|
||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/signup/REQUEST/FAILURE';
|
||||
|
||||
// Action Creater
|
||||
export type request = (member: Member) => Action<Member>;
|
||||
export type requestSuccess = (member: Member) => Action<Member>;
|
||||
export type requestFailure = (error: Error) => Action;
|
||||
|
||||
export const request: request = (member: Member): Action<Member> => {
|
||||
return {
|
||||
type: REQUEST,
|
||||
payload: member,
|
||||
};
|
||||
};
|
||||
|
||||
export const requestSuccess: requestSuccess = (member: Member): Action<Member> => {
|
||||
return {
|
||||
type: REQUEST_SUCCESS,
|
||||
payload: member,
|
||||
};
|
||||
};
|
||||
|
||||
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||
return {
|
||||
type: REQUEST_FAILURE,
|
||||
error: error,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -7,6 +7,7 @@ import SigninState, { defaultState as signinDefaultState } from '../state/SignIn
|
|||
|
||||
const reducer: ReducersMapObject = {
|
||||
[SigninActionTypes.REQUEST_SUCCESS]: (state: SigninState = signinDefaultState, action: Action<Member>): SigninState => {
|
||||
|
||||
return state;
|
||||
},
|
||||
[SigninActionTypes.REQUEST_FAILURE]: (state: SigninState = signinDefaultState, action: Action<Error>): SigninState => {
|
||||
|
|
|
@ -1,27 +1,17 @@
|
|||
import Action from '@overflow/commons/redux/Action';
|
||||
import { ReducersMapObject } from 'redux';
|
||||
import Member from '@overflow/member/api/model/Member';
|
||||
|
||||
import * as SignoutActionTypes from '../action/signOut';
|
||||
import SigninState, { defaultState as signinDefaultState } from '../state/SignIn';
|
||||
import * as SignOutActionTypes from '../action/signOut';
|
||||
import SignOutState, { defaultState as signOutDefaultState } from '../state/SignOut';
|
||||
|
||||
export type reducer = (state: SigninState, action: Action) => SigninState;
|
||||
|
||||
export const reducer: reducer = (state: SigninState = signinDefaultState, action: Action): SigninState => {
|
||||
switch (action.type) {
|
||||
case SignoutActionTypes.REQUEST_SUCCESS:
|
||||
{
|
||||
const aaa: SigninState = {
|
||||
...state,
|
||||
isAuthenticated: true,
|
||||
};
|
||||
|
||||
return aaa;
|
||||
}
|
||||
case SignoutActionTypes.REQUEST_FAILURE:
|
||||
{
|
||||
return state;
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
const reducer: ReducersMapObject = {
|
||||
[SignOutActionTypes.REQUEST_SUCCESS]: (state: SignOutState = signOutDefaultState, action: Action<Member>): SignOutState => {
|
||||
return state;
|
||||
},
|
||||
[SignOutActionTypes.REQUEST_FAILURE]: (state: SignOutState = signOutDefaultState, action: Action<Error>): SignOutState => {
|
||||
return state;
|
||||
},
|
||||
};
|
||||
|
||||
export default reducer;
|
||||
|
|
|
@ -1,29 +1,20 @@
|
|||
import Action from '@overflow/commons/redux/Action';
|
||||
import { ReducersMapObject } from 'redux';
|
||||
import Member from '@overflow/member/api/model/Member';
|
||||
|
||||
import * as SignupActionTypes from '../action/signUp';
|
||||
import SignupState, { defaultState as signupDefaultState } from '../state/SignUp';
|
||||
import * as SignUpActionTypes from '../action/signUp';
|
||||
import SignUpState, { defaultState as signupDefaultState } from '../state/SignUp';
|
||||
|
||||
export type reducer = (state: SignupState, action: Action<Member | Error>) => SignupState;
|
||||
const reducer: ReducersMapObject = {
|
||||
[SignUpActionTypes.REQUEST_SUCCESS]: (state: SignUpState = signupDefaultState, action: Action<Member>): SignUpState => {
|
||||
console.log(state);
|
||||
console.log(action);
|
||||
|
||||
export const reducer: reducer = (state: SignupState = signupDefaultState, action: Action<Member | Error>): SignupState => {
|
||||
switch (action.type) {
|
||||
case SignupActionTypes.REQUEST_SUCCESS:
|
||||
{
|
||||
let member = (<Action<Member>>action).payload;
|
||||
|
||||
const aaa: SignupState = {
|
||||
...state,
|
||||
isRegistered: true,
|
||||
};
|
||||
|
||||
return aaa;
|
||||
}
|
||||
case SignupActionTypes.REQUEST_FAILURE:
|
||||
{
|
||||
return state;
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
return state;
|
||||
},
|
||||
[SignUpActionTypes.REQUEST_FAILURE]: (state: SignUpState = signupDefaultState, action: Action<Error>): SignUpState => {
|
||||
return state;
|
||||
},
|
||||
};
|
||||
|
||||
export default reducer;
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 3.
|
||||
*/
|
||||
import Member from '../../api/model/Member';
|
||||
|
||||
export interface State {
|
||||
readonly error?: Error;
|
||||
}
|
||||
|
||||
export const defaultState: State = {
|
||||
error: undefined,
|
||||
};
|
||||
|
||||
export default State;
|
Loading…
Reference in New Issue
Block a user