Skip to content

Commit

Permalink
fix(admin-ui): resolve all bugs displayed for admin-ui bug #308
Browse files Browse the repository at this point in the history
  • Loading branch information
syntrydy committed Nov 26, 2021
1 parent 0e2a476 commit b4d6521
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 45 deletions.
26 changes: 10 additions & 16 deletions plugins/auth-server/redux/reducers/OIDCReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,9 @@ const reducerName = 'oidcReducer'
export default function oidcReducer(state = INIT_STATE, action) {
switch (action.type) {
case GET_OPENID_CLIENTS:
return {
...state,
loading: true,
}
return handleLoading()
case SEARCH_CLIENTS:
return {
...state,
loading: true,
}
return handleLoading()
case GET_OPENID_CLIENTS_RESPONSE:
if (action.payload.data) {
return {
Expand All @@ -46,10 +40,7 @@ export default function oidcReducer(state = INIT_STATE, action) {
}

case ADD_NEW_CLIENT:
return {
...state,
loading: true,
}
return handleLoading()
case ADD_CLIENT_RESPONSE:
if (action.payload.data) {
return {
Expand Down Expand Up @@ -83,10 +74,7 @@ export default function oidcReducer(state = INIT_STATE, action) {
}

case DELETE_CLIENT:
return {
...state,
loading: true,
}
return handleLoading()

case DELETE_CLIENT_RESPONSE:
if (action.payload.data) {
Expand Down Expand Up @@ -132,5 +120,11 @@ export default function oidcReducer(state = INIT_STATE, action) {
loading: false,
}
}
function handleLoading() {
return {
...state,
loading: true,
}
}
}
reducerRegistry.register(reducerName, oidcReducer)
42 changes: 13 additions & 29 deletions plugins/auth-server/redux/reducers/ScopeReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,9 @@ const reducerName = 'scopeReducer'
export default function scopeReducer(state = INIT_STATE, action) {
switch (action.type) {
case GET_SCOPES:
return {
...state,
loading: true,
}
return handleLoading()
case SEARCH_SCOPES:
return {
...state,
loading: true,
}
return handleLoading()
case GET_SCOPES_RESPONSE:
if (action.payload.data) {
return {
Expand All @@ -47,10 +41,7 @@ export default function scopeReducer(state = INIT_STATE, action) {
return handleDefault()
}
case GET_SCOPE_BY_INUM:
return {
...state,
loading: true,
}
return handleLoading()
case GET_SCOPE_BY_INUM_RESPONSE:
if (action.payload.data) {
return {
Expand All @@ -62,10 +53,7 @@ export default function scopeReducer(state = INIT_STATE, action) {
return handleDefault()
}
case GET_SCOPE_BY_PATTERN:
return {
...state,
loading: true,
}
return handleLoading()
case GET_SCOPE_BY_PATTERN_RESPONSE:
if (action.payload.data) {
return {
Expand All @@ -78,10 +66,7 @@ export default function scopeReducer(state = INIT_STATE, action) {
}

case ADD_SCOPE:
return {
...state,
loading: true,
}
return handleLoading()
case ADD_SCOPE_RESPONSE:
if (action.payload.data) {
return {
Expand All @@ -94,10 +79,7 @@ export default function scopeReducer(state = INIT_STATE, action) {
}

case EDIT_SCOPE:
return {
...state,
loading: true,
}
return handleLoading()

case EDIT_SCOPE_RESPONSE:
if (action.payload.data) {
Expand All @@ -110,10 +92,7 @@ export default function scopeReducer(state = INIT_STATE, action) {
return handleDefault()
}
case DELETE_SCOPE:
return {
...state,
loading: true,
}
return handleLoading()
case DELETE_SCOPE_RESPONSE:
if (action.payload.data) {
return {
Expand All @@ -140,7 +119,12 @@ export default function scopeReducer(state = INIT_STATE, action) {
default:
return handleDefault()
}

function handleLoading() {
return {
...state,
loading: true,
}
}
function handleDefault() {
return {
...state,
Expand Down

0 comments on commit b4d6521

Please sign in to comment.