|
|
@ -1,12 +1,11 @@ |
|
|
|
import { Action, AnyAction } from 'redux' |
|
|
|
import { ThunkAction, ThunkDispatch } from 'redux-thunk' |
|
|
|
import { Action } from 'redux' |
|
|
|
import { normalize } from 'normalizr' |
|
|
|
|
|
|
|
import { getGroup, getGroups } from '../api/groups' |
|
|
|
import { setEntity, setEntities } from '../actions/entities' |
|
|
|
import { startRequest, finishRequest } from '../actions/requests' |
|
|
|
import { groupSchema } from '../store/schemas' |
|
|
|
import { AppState } from '../types' |
|
|
|
import { AppThunkAction } from '../types' |
|
|
|
|
|
|
|
const FETCH_GROUP_ID = 'FETCH_GROUP' |
|
|
|
const FETCH_GROUPS_ID = 'FETCH_GROUPS' |
|
|
@ -43,8 +42,8 @@ export const setContinuation = (continuation: string): SetContinuationAction => |
|
|
|
payload: continuation, |
|
|
|
}) |
|
|
|
|
|
|
|
export const fetchGroup = (id: string): ThunkAction<Promise<void>, AppState, void, AnyAction> => { |
|
|
|
return async (dispatch: ThunkDispatch<AppState, void, AnyAction>) => { |
|
|
|
export const fetchGroup = (id: string): AppThunkAction => { |
|
|
|
return async dispatch => { |
|
|
|
dispatch(startRequest(FETCH_GROUP_ID)) |
|
|
|
|
|
|
|
try { |
|
|
@ -58,8 +57,8 @@ export const fetchGroup = (id: string): ThunkAction<Promise<void>, AppState, voi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export const fetchGroups = (sort?: string, continuation?: string): ThunkAction<Promise<void>, AppState, void, AnyAction> => { |
|
|
|
return async (dispatch: ThunkDispatch<AppState, void, AnyAction>) => { |
|
|
|
export const fetchGroups = (sort?: string, continuation?: string): AppThunkAction => { |
|
|
|
return async dispatch => { |
|
|
|
dispatch(startRequest(FETCH_GROUPS_ID)) |
|
|
|
|
|
|
|
try { |
|
|
|