API & Client - add/remove user admin rights - #15

This commit is contained in:
Sam
2020-05-01 12:12:48 +02:00
parent aa29231fd9
commit 7cc1b40f26
10 changed files with 320 additions and 27 deletions

View File

@ -28,6 +28,12 @@ export const updateSportsData = data => ({
type: 'UPDATE_SPORT_DATA',
data,
})
export const updateUsersData = data => ({
type: 'UPDATE_USER_DATA',
data,
})
export const getOrUpdateData = (
action,
target,
@ -47,6 +53,8 @@ export const getOrUpdateData = (
dispatch(setData(target, ret.data))
} else if (action === 'updateData' && target === 'sports') {
dispatch(updateSportsData(ret.data.sports[0]))
} else if (action === 'updateData' && target === 'users') {
dispatch(updateUsersData(ret.data.users[0]))
}
} else {
dispatch(setError(`${target}|${ret.message || ret.status}`))