You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
772 B
34 lines
772 B
import { Action } from 'redux'
|
|
import { RequestKey } from '../types'
|
|
|
|
export interface StartRequestAction extends Action {
|
|
type: 'REQUESTS_START_REQUEST'
|
|
payload: {
|
|
id: RequestKey
|
|
}
|
|
}
|
|
|
|
export interface FinishRequestAction extends Action {
|
|
type: 'REQUESTS_FINISH_REQUEST'
|
|
payload: {
|
|
id: RequestKey
|
|
succeeded: boolean
|
|
}
|
|
}
|
|
|
|
export type RequestsActions = StartRequestAction | FinishRequestAction
|
|
|
|
export const startRequest = (id: RequestKey): StartRequestAction => ({
|
|
type: 'REQUESTS_START_REQUEST',
|
|
payload: {
|
|
id,
|
|
},
|
|
})
|
|
|
|
export const finishRequest = (id: RequestKey, succeeded: boolean): FinishRequestAction => ({
|
|
type: 'REQUESTS_FINISH_REQUEST',
|
|
payload: {
|
|
id,
|
|
succeeded,
|
|
},
|
|
})
|