parent
ab54675c82
commit
5988bc8869
@ -1,16 +0,0 @@ |
||||
//@flow
|
||||
|
||||
export type async_action_type = "SEND_MESSAGE" |
||||
export type static_action_type = "SEND_MESSAGE" |
||||
|
||||
export type AsyncAction = {| |
||||
type: async_action_type, |
||||
payload: Promise<*> |
||||
|} |
||||
|
||||
export type StaticAction<T> = {| |
||||
type: static_action_type, |
||||
payload: T |
||||
|} |
||||
|
||||
export type Action<T> = AsyncAction | StaticAction<T> |
@ -1,4 +1,4 @@ |
||||
//@flow
|
||||
|
||||
export { send_message } from "./message" |
||||
export type * from "./action" |
||||
export type { Action } from "./message" |
||||
|
@ -1,6 +1,15 @@ |
||||
//@flow
|
||||
|
||||
import { combineReducers } from "redux" |
||||
import type { Reducer } from "redux" |
||||
import message from "./message" |
||||
import type { Action } from "../action" |
||||
import type { State as MessageState } from "./message" |
||||
|
||||
export default combineReducers({ message }) |
||||
export type State = { |
||||
message: MessageState |
||||
} |
||||
|
||||
const reducers: Reducer<State, Action> = combineReducers({ message }) |
||||
|
||||
export default reducers |
||||
|
@ -1,15 +1,14 @@ |
||||
//@flow
|
||||
|
||||
import { applyMiddleware } from "redux" |
||||
import type { StoreEnhancer } from "redux" |
||||
import thunk from "redux-thunk" |
||||
import logger from "redux-logger" |
||||
import promise from "redux-promise-middleware" |
||||
import type { State } from "../reducer" |
||||
import type { Action } from "../action" |
||||
|
||||
export default () => { |
||||
if(process.env.NODE_ENV !== "production") { |
||||
return applyMiddleware(promise, thunk, logger) |
||||
} else { |
||||
return applyMiddleware(promise, thunk) |
||||
} |
||||
} |
||||
|
||||
export default (): StoreEnhancer<State, Action> => |
||||
process.env.NODE_ENV !== "production" ? |
||||
applyMiddleware(promise, thunk) : |
||||
applyMiddleware(promise, thunk, logger) |
||||
|
Loading…
Reference in new issue