diff --git a/config/webpack/webpack.config.base.js b/config/webpack/webpack.config.base.js index d6d7e84..0bcde06 100644 --- a/config/webpack/webpack.config.base.js +++ b/config/webpack/webpack.config.base.js @@ -6,7 +6,7 @@ module.exports = { target: 'web', entry: { app: [ - Path.resolve(__dirname, '../../src/ts/index.tsx') + Path.resolve(__dirname, '../../src/ts/app/index.tsx') ], vendor: Object.keys(packages.dependencies) }, diff --git a/src/ts/index.tsx b/src/ts/app/index.tsx similarity index 100% rename from src/ts/index.tsx rename to src/ts/app/index.tsx diff --git a/src/ts/app/views/container/component/App.tsx b/src/ts/app/views/component/App.tsx similarity index 100% rename from src/ts/app/views/container/component/App.tsx rename to src/ts/app/views/component/App.tsx diff --git a/src/ts/commons/module/Module.ts b/src/ts/commons/module/Module.ts deleted file mode 100644 index de4e80e..0000000 --- a/src/ts/commons/module/Module.ts +++ /dev/null @@ -1,8 +0,0 @@ -interface IModule { - components: IComponentType; - containers: IContainerType; - views: IViewType; - redux: IReduxType; -} - -export default IModule; diff --git a/src/ts/commons/redux/Module.ts b/src/ts/commons/redux/Module.ts deleted file mode 100644 index e1d4d79..0000000 --- a/src/ts/commons/redux/Module.ts +++ /dev/null @@ -1,8 +0,0 @@ -import Action from './Action'; - -export interface IModule { - state: State; - reducer: (state: State, action: Action) => State; -} - -export default IModule; diff --git a/src/ts/commons/redux/router.ts b/src/ts/commons/redux/router.ts deleted file mode 100644 index 6322e29..0000000 --- a/src/ts/commons/redux/router.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Action from 'commons/redux/Action'; -import { RouterState, LocationActionPayload, LOCATION_CHANGE } from 'react-router-redux'; - -export const initRouterState: RouterState = { - location: null, -}; - - -export function routerReducer(state: RouterState = initRouterState, action: Action): RouterState { - if (action.type === LOCATION_CHANGE) { - return state; - } - return state; -} diff --git a/src/ts/config/configureMuiTheme.ts b/src/ts/config/configureMuiTheme.ts deleted file mode 100644 index 7e890fd..0000000 --- a/src/ts/config/configureMuiTheme.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { colors, getMuiTheme, MuiTheme, spacing } from 'material-ui/styles'; -import { fade } from 'material-ui/utils/colorManipulator'; - -const muiTheme:MuiTheme = getMuiTheme({ - spacing: spacing, - fontFamily: 'Roboto, sans-serif', - palette: { - primary1Color: colors.cyan500, - primary2Color: colors.cyan700, - primary3Color: colors.grey400, - accent1Color: colors.pinkA200, - accent2Color: colors.grey100, - accent3Color: colors.grey500, - textColor: colors.darkBlack, - alternateTextColor: colors.white, - canvasColor: colors.white, - borderColor: colors.grey300, - disabledColor: fade(colors.darkBlack, 0.3), - pickerHeaderColor: colors.cyan500, - clockCircleColor: fade(colors.darkBlack, 0.07), - shadowColor: colors.fullBlack, - }, -}); - -export default muiTheme; diff --git a/src/ts/config/configureRedux.ts b/src/ts/config/configureRedux.ts deleted file mode 100644 index 1d40bd6..0000000 --- a/src/ts/config/configureRedux.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Action, combineReducers } from 'redux'; -import { RouterState, LocationActionPayload, LOCATION_CHANGE } from 'react-router-redux'; -import { SagaIterator } from 'redux-saga'; -import { fork } from 'redux-saga/effects'; -import { routerReducer } from 'commons/redux/router'; - -import * as Member from 'member'; - -export interface State { - member: Member.State; - router: RouterState; -} - -export const reducer = combineReducers({ - member: Member.reducer, - router: routerReducer, -}); - -export function* sagas(): SagaIterator { - yield fork(Member.sagas); -} diff --git a/src/ts/config/configureRouter.tsx b/src/ts/config/configureRouter.tsx deleted file mode 100644 index 139597f..0000000 --- a/src/ts/config/configureRouter.tsx +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/src/ts/config/configureStore.ts b/src/ts/config/configureStore.ts deleted file mode 100644 index b8d3e3b..0000000 --- a/src/ts/config/configureStore.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { applyMiddleware, compose, createStore, Store } from 'redux'; -import { routerMiddleware } from 'react-router-redux'; -import { SagaMiddleware } from 'redux-saga'; -import { History } from 'history'; - -import { reducer, State } from './configureRedux'; - -export default function configureStore(history: History, sagaMiddleware: SagaMiddleware): Store { - const middlewares = [sagaMiddleware, routerMiddleware(history)]; - const store = createStore( - reducer, - applyMiddleware(...middlewares), - ); - - // sagaMiddleware.run(rootSaga); - - return store; -} diff --git a/src/ts/member/api/service/MemberService.ts b/src/ts/member/api/service/MemberService.ts new file mode 100644 index 0000000..f8956cb --- /dev/null +++ b/src/ts/member/api/service/MemberService.ts @@ -0,0 +1,3 @@ +export class MemberService { + +} diff --git a/src/ts/member/redux/action/signin.ts b/src/ts/member/redux/action/signin.ts new file mode 100644 index 0000000..cef6910 --- /dev/null +++ b/src/ts/member/redux/action/signin.ts @@ -0,0 +1,45 @@ +import Action from 'commons/redux/Action'; +import Member from 'member/api/model/Member'; + +import SigninPayload from '../payload/SigninPayload'; + +// Action Type +export type REQUEST = '@overflow/member/signin/REQUEST'; +export type REQUEST_SUCCESS = '@overflow/member/signin/REQUEST_SUCCESS'; +export type REQUEST_FAILURE = '@overflow/member/signin/REQUEST_FAILURE'; + +export const REQUEST: REQUEST = '@overflow/member/signin/REQUEST'; +export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/signin/REQUEST_SUCCESS'; +export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/signin/REQUEST_FAILURE'; + +export type ActionTypes = REQUEST | REQUEST_SUCCESS | REQUEST_FAILURE; + + +// Action Creater +export type request = (signinId: string, signinPw: string) => Action; +export type requestSuccess = (member: Member) => Action; +export type requestFailure = (error: Error) => Action; + +export const request: request = (signinId: string, signinPw: string): Action => { + return { + type: REQUEST, + payload: { + signinId: signinId, + signinPw: signinPw, + }, + }; +}; + +export const requestSuccess: requestSuccess = (member: Member): Action => { + return { + type: REQUEST_SUCCESS, + payload: member, + }; +}; + +export const requestFailure: requestFailure = (error: Error): Action => { + return { + type: REQUEST_FAILURE, + error: error, + }; +}; diff --git a/src/ts/member/redux/action/signout.ts b/src/ts/member/redux/action/signout.ts new file mode 100644 index 0000000..414b7e6 --- /dev/null +++ b/src/ts/member/redux/action/signout.ts @@ -0,0 +1,37 @@ +import Action from 'commons/redux/Action'; + +// Action Type +export type REQUEST = '@overflow/member/signout/REQUEST'; +export type REQUEST_SUCCESS = '@overflow/member/signout/REQUEST_SUCCESS'; +export type REQUEST_FAILURE = '@overflow/member/signout/REQUEST_FAILURE'; + +export const REQUEST: REQUEST = '@overflow/member/signout/REQUEST'; +export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/member/signout/REQUEST_SUCCESS'; +export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/member/signout/REQUEST_FAILURE'; + +export type ActionTypes = REQUEST | REQUEST_SUCCESS | REQUEST_FAILURE; + + +// Action Creater +export type request = () => Action; +export type requestSuccess = () => Action; +export type requestFailure = (error: Error) => Action; + +export const request: request = (): Action => { + return { + type: REQUEST, + }; +}; + +export const requestSuccess: requestSuccess = (): Action => { + return { + type: REQUEST_SUCCESS, + }; +}; + +export const requestFailure: requestFailure = (error: Error): Action => { + return { + type: REQUEST_FAILURE, + error: error, + }; +}; diff --git a/src/ts/member/redux/action/signup.ts b/src/ts/member/redux/action/signup.ts new file mode 100644 index 0000000..b11503d --- /dev/null +++ b/src/ts/member/redux/action/signup.ts @@ -0,0 +1,42 @@ +import Action from 'commons/redux/Action'; +import Member from '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 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 type ActionTypes = REQUEST | REQUEST_SUCCESS | REQUEST_FAILURE; + + +// Action Creater +export type request = (member: Member) => Action; +export type requestSuccess = (member: Member) => Action; +export type requestFailure = (error: Error) => Action; + +export const request: request = (member: Member): Action => { + return { + type: REQUEST, + payload: member, + }; +}; + +export const requestSuccess: requestSuccess = (member: Member): Action => { + return { + type: REQUEST_SUCCESS, + payload: member, + }; +}; + +export const requestFailure: requestFailure = (error: Error): Action => { + return { + type: REQUEST_FAILURE, + error: error, + }; +}; diff --git a/src/ts/member/signin/redux/payload/SigninPayload.ts b/src/ts/member/redux/payload/SigninPayload.ts similarity index 100% rename from src/ts/member/signin/redux/payload/SigninPayload.ts rename to src/ts/member/redux/payload/SigninPayload.ts diff --git a/src/ts/member/redux/reducer/signin.ts b/src/ts/member/redux/reducer/signin.ts new file mode 100644 index 0000000..c0c227e --- /dev/null +++ b/src/ts/member/redux/reducer/signin.ts @@ -0,0 +1,29 @@ +import Action from 'commons/redux/Action'; +import Member from 'member/api/model/Member'; + +import SigninActionTypes from '../action/signin'; +import SigninState, { defaultState as signinDefaultState } from '../state/Signin'; + +export type reducer = (state: SigninState, action: Action) => SigninState; + +export const reducer: reducer = (state: SigninState = signinDefaultState, action: Action): SigninState => { + switch (action.type) { + case SigninActionTypes.REQUEST_SUCCESS: + { + let member = (>action).payload; + + const aaa: SigninState = { + ...state, + isAuthenticated: true, + }; + + return aaa; + } + case SigninActionTypes.REQUEST_FAILURE: + { + return state; + } + default: + return state; + } +}; diff --git a/src/ts/member/redux/reducer/signout.ts b/src/ts/member/redux/reducer/signout.ts new file mode 100644 index 0000000..d9b2c57 --- /dev/null +++ b/src/ts/member/redux/reducer/signout.ts @@ -0,0 +1,27 @@ +import Action from 'commons/redux/Action'; +import Member from 'member/api/model/Member'; + +import SignoutActionTypes from '../action/signout'; +import SigninState, { defaultState as signinDefaultState } from '../state/Signin'; + +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; + } +}; diff --git a/src/ts/member/redux/reducer/signup.ts b/src/ts/member/redux/reducer/signup.ts new file mode 100644 index 0000000..39a82d9 --- /dev/null +++ b/src/ts/member/redux/reducer/signup.ts @@ -0,0 +1,29 @@ +import Action from 'commons/redux/Action'; +import Member from 'member/api/model/Member'; + +import SignupActionTypes from '../action/signup'; +import SignupState, { defaultState as signupDefaultState } from '../state/Signup'; + +export type reducer = (state: SignupState, action: Action) => SignupState; + +export const reducer: reducer = (state: SignupState = signupDefaultState, action: Action): SignupState => { + switch (action.type) { + case SignupActionTypes.REQUEST_SUCCESS: + { + let member = (>action).payload; + + const aaa: SignupState = { + ...state, + isRegistered: true, + }; + + return aaa; + } + case SignupActionTypes.REQUEST_FAILURE: + { + return state; + } + default: + return state; + } +}; diff --git a/src/ts/member/signin/redux/saga/signin.ts b/src/ts/member/redux/saga/signin.ts similarity index 80% rename from src/ts/member/signin/redux/saga/signin.ts rename to src/ts/member/redux/saga/signin.ts index 1a13f4d..6186d03 100644 --- a/src/ts/member/signin/redux/saga/signin.ts +++ b/src/ts/member/redux/saga/signin.ts @@ -1,11 +1,10 @@ -import { takeLatest, SagaIterator } from 'redux-saga'; -import { call, Effect, fork, put } from 'redux-saga/effects'; +import { SagaIterator } from 'redux-saga'; +import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects'; import Action from 'commons/redux/Action'; import Member from 'member/api/model/Member'; -import actions from '../action'; -import actionTypes from '../action/type'; +import SigninActions from '../action/signin'; import SigninPayload from '../payload/SigninPayload'; const apiSignin = (signinId: string, signinPw: string): Promise => { @@ -36,9 +35,9 @@ function* signin(action: Action): Iterable { // if (responseBody.token === undefined) { // throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE); // } - yield put(actions.requestSuccess(member)); + yield put(SigninActions.requestSuccess(member)); } catch (e) { - yield put(actions.requestFailure(e)); + yield put(SigninActions.requestFailure(e)); } finally { // yield put({ // type: types.SENDING_REQUEST, diff --git a/src/ts/member/signin/redux/state/index.ts b/src/ts/member/redux/state/Signin.ts similarity index 68% rename from src/ts/member/signin/redux/state/index.ts rename to src/ts/member/redux/state/Signin.ts index 5ddc23b..2abbf40 100644 --- a/src/ts/member/signin/redux/state/index.ts +++ b/src/ts/member/redux/state/Signin.ts @@ -1,14 +1,12 @@ import Member from 'member/api/model/Member'; export interface State { - isAuthenticated: boolean; - member?: Member; - error?: Error; + readonly isAuthenticated: boolean; + readonly error?: Error; } export const defaultState: State = { isAuthenticated: undefined, - member: undefined, error: undefined, }; diff --git a/src/ts/member/signup/redux/state/index.ts b/src/ts/member/redux/state/Signup.ts similarity index 70% rename from src/ts/member/signup/redux/state/index.ts rename to src/ts/member/redux/state/Signup.ts index 06e31a6..ba372f8 100644 --- a/src/ts/member/signup/redux/state/index.ts +++ b/src/ts/member/redux/state/Signup.ts @@ -1,9 +1,9 @@ import Member from 'member/api/model/Member'; export interface State { - isRegistered: boolean; - member?: Member; - error?: Error; + readonly isRegistered: boolean; + readonly member?: Member; + readonly error?: Error; } export const defaultState: State = { diff --git a/src/ts/member/signin/index.ts b/src/ts/member/signin/index.ts deleted file mode 100644 index 9686012..0000000 --- a/src/ts/member/signin/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './redux'; diff --git a/src/ts/member/signin/redux/action/index.ts b/src/ts/member/signin/redux/action/index.ts deleted file mode 100644 index edaccdd..0000000 --- a/src/ts/member/signin/redux/action/index.ts +++ /dev/null @@ -1,41 +0,0 @@ -import Action from 'commons/redux/Action'; - -import Member from 'member/api/model/Member'; - -import actionTypes from './type'; -import SigninPayload from '../payload/SigninPayload'; - - -export interface Actions { - request: (signinId: string, signinPw: string) => Action; - requestSuccess: (member: Member) => Action; - requestFailure: (error: Error) => Action; -} - -export const actions: Actions = { - request(signinId: string, signinPw: string): Action { - return { - type: actionTypes.REQUEST, - payload: { - signinId: signinId, - signinPw: signinPw, - }, - }; - }, - - requestSuccess(member: Member): Action { - return { - type: actionTypes.REQUEST_SUCCESS, - payload: member, - }; - }, - - requestFailure(error: Error): Action { - return { - type: actionTypes.REQUEST_FAILURE, - error: error, - }; - }, -}; - -export default actions; diff --git a/src/ts/member/signin/redux/action/type.ts b/src/ts/member/signin/redux/action/type.ts deleted file mode 100644 index 79ce1c7..0000000 --- a/src/ts/member/signin/redux/action/type.ts +++ /dev/null @@ -1,17 +0,0 @@ -export type REQUEST = '@overflow/member/signin/REQUEST'; -export type REQUEST_SUCCESS = '@overflow/member/signin/REQUEST_SUCCESS'; -export type REQUEST_FAILURE = '@overflow/member/signin/REQUEST_FAILURE'; - -export interface ActionTypes { - REQUEST: REQUEST; - REQUEST_SUCCESS: REQUEST_SUCCESS; - REQUEST_FAILURE: REQUEST_FAILURE; -} - -export const actionTypes: ActionTypes = { - REQUEST: '@overflow/member/signin/REQUEST', - REQUEST_SUCCESS: '@overflow/member/signin/REQUEST_SUCCESS', - REQUEST_FAILURE: '@overflow/member/signin/REQUEST_FAILURE', -}; - -export default actionTypes; diff --git a/src/ts/member/signin/redux/index.ts b/src/ts/member/signin/redux/index.ts deleted file mode 100644 index 0ee2789..0000000 --- a/src/ts/member/signin/redux/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './state'; -export * from './reducer'; -export * from './saga'; diff --git a/src/ts/member/signin/redux/reducer/index.ts b/src/ts/member/signin/redux/reducer/index.ts deleted file mode 100644 index c6f9e4c..0000000 --- a/src/ts/member/signin/redux/reducer/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -import Action from 'commons/redux/Action'; -import IModule from 'commons/redux/Module'; - -import Member from 'member/api/model/Member'; - -import actionTypes from '../action/type'; -import State, { defaultState } from '../state'; - - -export function reducer(state: State = defaultState, action: Action): State { - switch (action.type) { - case actionTypes.REQUEST_SUCCESS: - { - - - return state; - } - case actionTypes.REQUEST_FAILURE: - { - return state; - } - default: - return state; - } -} diff --git a/src/ts/member/signin/redux/saga/index.ts b/src/ts/member/signin/redux/saga/index.ts deleted file mode 100644 index dc2c7a2..0000000 --- a/src/ts/member/signin/redux/saga/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { SagaIterator } from 'redux-saga'; -import { fork, ForkEffect } from 'redux-saga/effects'; - -import { watchSignin } from './signin'; - -export function* sagas(): SagaIterator { - yield fork(watchSignin); -} diff --git a/src/ts/member/signout/index.ts b/src/ts/member/signout/index.ts deleted file mode 100644 index 9686012..0000000 --- a/src/ts/member/signout/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './redux'; diff --git a/src/ts/member/signout/redux/action/index.ts b/src/ts/member/signout/redux/action/index.ts deleted file mode 100644 index 3cda6f7..0000000 --- a/src/ts/member/signout/redux/action/index.ts +++ /dev/null @@ -1,33 +0,0 @@ -import Action from 'commons/redux/Action'; - -import actionTypes from './type'; -import SignoutPayload from '../payload/SignoutPayload'; - -export interface Actions { - request: () => Action; - requestSuccess: () => Action; - requestFailure: (error: Error) => Action; -} - -export const actions: Actions = { - request(): Action { - return { - type: actionTypes.REQUEST, - }; - }, - - requestSuccess(): Action { - return { - type: actionTypes.REQUEST_SUCCESS, - }; - }, - - requestFailure(error: Error): Action { - return { - type: actionTypes.REQUEST_FAILURE, - error: error, - }; - }, -}; - -export default actions; diff --git a/src/ts/member/signout/redux/action/type.ts b/src/ts/member/signout/redux/action/type.ts deleted file mode 100644 index 99769a7..0000000 --- a/src/ts/member/signout/redux/action/type.ts +++ /dev/null @@ -1,17 +0,0 @@ -export type REQUEST = '@overflow/member/signout/REQUEST'; -export type REQUEST_SUCCESS = '@overflow/member/signout/REQUEST_SUCCESS'; -export type REQUEST_FAILURE = '@overflow/member/signout/REQUEST_FAILURE'; - -export interface ActionTypes { - REQUEST: REQUEST; - REQUEST_SUCCESS: REQUEST_SUCCESS; - REQUEST_FAILURE: REQUEST_FAILURE; -} - -export const actionTypes: ActionTypes = { - REQUEST: '@overflow/member/signout/REQUEST', - REQUEST_SUCCESS: '@overflow/member/signout/REQUEST_SUCCESS', - REQUEST_FAILURE: '@overflow/member/signout/REQUEST_FAILURE', -}; - -export default actionTypes; diff --git a/src/ts/member/signout/redux/index.ts b/src/ts/member/signout/redux/index.ts deleted file mode 100644 index 34d7d96..0000000 --- a/src/ts/member/signout/redux/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './state'; -export * from './reducer'; diff --git a/src/ts/member/signout/redux/payload/SignoutPayload.ts b/src/ts/member/signout/redux/payload/SignoutPayload.ts deleted file mode 100644 index 43ba490..0000000 --- a/src/ts/member/signout/redux/payload/SignoutPayload.ts +++ /dev/null @@ -1,4 +0,0 @@ -interface SignoutPayload { -} - -export default SignoutPayload; diff --git a/src/ts/member/signout/redux/reducer/index.ts b/src/ts/member/signout/redux/reducer/index.ts deleted file mode 100644 index b778369..0000000 --- a/src/ts/member/signout/redux/reducer/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -import Action from 'commons/redux/Action'; -import IModule from 'commons/redux/Module'; -import actionTypes from '../action/type'; -import State, { defaultState } from '../state'; - - -export function reducer(state: State = defaultState, action: Action): State { - switch (action.type) { - case actionTypes.REQUEST_SUCCESS: - { - - return state; - } - case actionTypes.REQUEST_FAILURE: - { - return state; - } - default: - return state; - } -} diff --git a/src/ts/member/signout/redux/saga/index.ts b/src/ts/member/signout/redux/saga/index.ts deleted file mode 100644 index 3046f88..0000000 --- a/src/ts/member/signout/redux/saga/index.ts +++ /dev/null @@ -1,44 +0,0 @@ -// import Action from 'commons/redux/Action'; -// import { SigninPayload } from 'member/signin/redux'; -// import { takeLatest } from 'redux-saga'; -// import { call, put } from 'redux-saga/effects'; - -// export function * signin(action: Action) { -// try { -// const {signinId, signinPw} = action.payload; -// yield put({ -// type: types.SENDING_REQUEST, -// payload: {sendingRequest: true}, -// }); - -// const responseBody = yield call(api.login, signinId, signinPw); - -// if (responseBody.token === undefined) { -// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE); -// } - -// yield put({ -// type: types.LOGIN__SUCCEEDED, -// payload: { -// idToken: responseBody.token, -// }, -// }); -// } catch (e) { -// yield put({ -// type: types.LOGIN__FAILED, -// payload: { -// message: e.message, -// statusCode: e.statusCode, -// }, -// }); -// } finally { -// yield put({ -// type: types.SENDING_REQUEST, -// payload: {sendingRequest: false}, -// }); -// } -// } - -// export function * watchSignin() { -// yield * takeLatest(types.LOGIN__REQUESTED, signin); -// } diff --git a/src/ts/member/signout/redux/state/index.ts b/src/ts/member/signout/redux/state/index.ts deleted file mode 100644 index 5ddc23b..0000000 --- a/src/ts/member/signout/redux/state/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import Member from 'member/api/model/Member'; - -export interface State { - isAuthenticated: boolean; - member?: Member; - error?: Error; -} - -export const defaultState: State = { - isAuthenticated: undefined, - member: undefined, - error: undefined, -}; - -export default State; diff --git a/src/ts/member/signout/views/Signin.tsx b/src/ts/member/signout/views/Signin.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/ts/member/signout/views/containers/Signin.tsx b/src/ts/member/signout/views/containers/Signin.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/ts/member/signout/views/containers/components/Signin.tsx b/src/ts/member/signout/views/containers/components/Signin.tsx deleted file mode 100644 index 2a059b4..0000000 --- a/src/ts/member/signout/views/containers/components/Signin.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; - -import { - Dialog, - Divider, - FlatButton, - MenuItem, - Paper, - RaisedButton, - SelectField, - Slider, - TextField, -} from 'material-ui'; - -export interface Props { - onSignin?: (signinId: string, signinPw: string) => void; - onSignup?: () => void; - onResetPassword?: () => void; -} - -export interface State { - signinId: string; - signinPw: string; -} - -export class Signin extends React.Component { - public static defaultProps: Partial = { - onSignin: (signinId: string, signinPw: string): void => { - console.log('onSignin'); - }, - onSignup: (): void => { - console.log('onSignup'); - }, - onResetPassword: (): void => { - console.log('onResetPassword'); - }, - }; - - public constructor(props: Props, context: State) { - super(props, context); - } - - public render(): JSX.Element { - - return ( -
- this.setState({ signinId: newValue })} - /> -
- this.setState({ signinPw: newValue })} - /> -
- - this.props.onSignin(this.state.signinId, this.state.signinPw)} - /> - - - -
- ); - } -} diff --git a/src/ts/member/signup/index.ts b/src/ts/member/signup/index.ts deleted file mode 100644 index 9686012..0000000 --- a/src/ts/member/signup/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './redux'; diff --git a/src/ts/member/signup/redux/action/index.ts b/src/ts/member/signup/redux/action/index.ts deleted file mode 100644 index f53affc..0000000 --- a/src/ts/member/signup/redux/action/index.ts +++ /dev/null @@ -1,37 +0,0 @@ -import Action from 'commons/redux/Action'; - -import Member from 'member/api/model/Member'; - -import actionTypes from './type'; -import SignupPayload from '../payload/SignupPayload'; - -export interface Actions { - request: (signupPayload: SignupPayload) => Action; - requestSuccess: (member: Member) => Action; - requestFailure: (error: Error) => Action; -} - -export const actions: Actions = { - request(signupPayload: SignupPayload): Action { - return { - type: actionTypes.REQUEST, - payload: signupPayload, - }; - }, - - requestSuccess(member: Member): Action { - return { - type: actionTypes.REQUEST_SUCCESS, - payload: member, - }; - }, - - requestFailure(error: Error): Action { - return { - type: actionTypes.REQUEST_FAILURE, - error: error, - }; - }, -}; - -export default actions; diff --git a/src/ts/member/signup/redux/action/type.ts b/src/ts/member/signup/redux/action/type.ts deleted file mode 100644 index 80c2218..0000000 --- a/src/ts/member/signup/redux/action/type.ts +++ /dev/null @@ -1,17 +0,0 @@ -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 interface ActionTypes { - REQUEST: REQUEST; - REQUEST_SUCCESS: REQUEST_SUCCESS; - REQUEST_FAILURE: REQUEST_FAILURE; -} - -export const actionTypes: ActionTypes = { - REQUEST: '@overflow/member/signup/REQUEST', - REQUEST_SUCCESS: '@overflow/member/signup/REQUEST_SUCCESS', - REQUEST_FAILURE: '@overflow/member/signup/REQUEST_FAILURE', -}; - -export default actionTypes; diff --git a/src/ts/member/signup/redux/index.ts b/src/ts/member/signup/redux/index.ts deleted file mode 100644 index 34d7d96..0000000 --- a/src/ts/member/signup/redux/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './state'; -export * from './reducer'; diff --git a/src/ts/member/signup/redux/payload/SignupPayload.ts b/src/ts/member/signup/redux/payload/SignupPayload.ts deleted file mode 100644 index 82963c0..0000000 --- a/src/ts/member/signup/redux/payload/SignupPayload.ts +++ /dev/null @@ -1,6 +0,0 @@ -import Member from 'member/api/model/Member'; - -interface SignupPayload extends Member { -} - -export default SignupPayload; diff --git a/src/ts/member/signup/redux/reducer/index.ts b/src/ts/member/signup/redux/reducer/index.ts deleted file mode 100644 index 89dfca9..0000000 --- a/src/ts/member/signup/redux/reducer/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -import Action from 'commons/redux/Action'; -import IModule from 'commons/redux/Module'; - -import Member from 'member/api/model/Member'; - -import actionTypes from '../action/type'; -import State, { defaultState } from '../state'; - - -export function reducer(state: State = defaultState, action: Action): State { - switch (action.type) { - case actionTypes.REQUEST_SUCCESS: - { - - return state; - } - case actionTypes.REQUEST_FAILURE: - { - return state; - } - default: - return state; - } -} diff --git a/src/ts/member/signup/redux/saga/index.ts b/src/ts/member/signup/redux/saga/index.ts deleted file mode 100644 index 3046f88..0000000 --- a/src/ts/member/signup/redux/saga/index.ts +++ /dev/null @@ -1,44 +0,0 @@ -// import Action from 'commons/redux/Action'; -// import { SigninPayload } from 'member/signin/redux'; -// import { takeLatest } from 'redux-saga'; -// import { call, put } from 'redux-saga/effects'; - -// export function * signin(action: Action) { -// try { -// const {signinId, signinPw} = action.payload; -// yield put({ -// type: types.SENDING_REQUEST, -// payload: {sendingRequest: true}, -// }); - -// const responseBody = yield call(api.login, signinId, signinPw); - -// if (responseBody.token === undefined) { -// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE); -// } - -// yield put({ -// type: types.LOGIN__SUCCEEDED, -// payload: { -// idToken: responseBody.token, -// }, -// }); -// } catch (e) { -// yield put({ -// type: types.LOGIN__FAILED, -// payload: { -// message: e.message, -// statusCode: e.statusCode, -// }, -// }); -// } finally { -// yield put({ -// type: types.SENDING_REQUEST, -// payload: {sendingRequest: false}, -// }); -// } -// } - -// export function * watchSignin() { -// yield * takeLatest(types.LOGIN__REQUESTED, signin); -// } diff --git a/src/ts/member/signup/views/Signin.tsx b/src/ts/member/signup/views/Signin.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/ts/member/signup/views/containers/Signin.tsx b/src/ts/member/signup/views/containers/Signin.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/ts/member/signup/views/containers/components/Signin.tsx b/src/ts/member/signup/views/containers/components/Signin.tsx deleted file mode 100644 index 2a059b4..0000000 --- a/src/ts/member/signup/views/containers/components/Signin.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; - -import { - Dialog, - Divider, - FlatButton, - MenuItem, - Paper, - RaisedButton, - SelectField, - Slider, - TextField, -} from 'material-ui'; - -export interface Props { - onSignin?: (signinId: string, signinPw: string) => void; - onSignup?: () => void; - onResetPassword?: () => void; -} - -export interface State { - signinId: string; - signinPw: string; -} - -export class Signin extends React.Component { - public static defaultProps: Partial = { - onSignin: (signinId: string, signinPw: string): void => { - console.log('onSignin'); - }, - onSignup: (): void => { - console.log('onSignup'); - }, - onResetPassword: (): void => { - console.log('onResetPassword'); - }, - }; - - public constructor(props: Props, context: State) { - super(props, context); - } - - public render(): JSX.Element { - - return ( -
- this.setState({ signinId: newValue })} - /> -
- this.setState({ signinPw: newValue })} - /> -
- - this.props.onSignin(this.state.signinId, this.state.signinPw)} - /> - - - -
- ); - } -} diff --git a/src/ts/member/signin/views/Signin.tsx b/src/ts/member/views/Signin.tsx similarity index 100% rename from src/ts/member/signin/views/Signin.tsx rename to src/ts/member/views/Signin.tsx diff --git a/src/ts/commons/redux/saga.ts b/src/ts/member/views/Signup.tsx similarity index 100% rename from src/ts/commons/redux/saga.ts rename to src/ts/member/views/Signup.tsx diff --git a/src/ts/member/signin/views/containers/components/Signin.tsx b/src/ts/member/views/components/Signin.tsx similarity index 96% rename from src/ts/member/signin/views/containers/components/Signin.tsx rename to src/ts/member/views/components/Signin.tsx index b53aa05..4da6115 100644 --- a/src/ts/member/signin/views/containers/components/Signin.tsx +++ b/src/ts/member/views/components/Signin.tsx @@ -14,6 +14,7 @@ import { } from 'material-ui'; export interface Props { + isSignin?: boolean; onSignin?: (signinId: string, signinPw: string) => void; onSignup?: () => void; onResetPassword?: () => void; @@ -48,7 +49,7 @@ export class Signin extends React.Component { public render(): JSX.Element { - return ( + return (this.props.isSignin ?
Signed
: