Admin: get sports list

This commit is contained in:
Sam
2018-04-29 18:23:46 +02:00
parent c8f1b4aebe
commit cb8c24a932
6 changed files with 111 additions and 1 deletions

View File

@ -0,0 +1,31 @@
import mpwoApi from '../mwpoApi/index'
export const setData = (target, data) => ({
type: 'SET_DATA',
data,
target,
})
export const setError = (target, error) => ({
type: 'SET_ERROR',
error,
target,
})
export function getData(target) {
return function(dispatch) {
return mpwoApi
.getData(target)
.then(ret => {
if (ret.status === 'success') {
dispatch(setData(target, ret.data))
} else {
dispatch(setError(target, ret.message))
}
})
.catch(error => {
throw error
})
}
}