Skip to content

Commit

Permalink
Redirect WebUI to login page on server failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Fedorov committed Dec 5, 2019
1 parent 19729f2 commit 3fe911e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/webui/frontend/src/actions/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,5 @@ export type EditRulesActions =
| RevertRuleAction
| SaveRuleActions
| UpdatePolicyTitleAction
| UpdatePolicyDescriptionAction;
| UpdatePolicyDescriptionAction
| LoadRulesActions;
6 changes: 2 additions & 4 deletions src/webui/frontend/src/reducers/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ export const data: Reducer<SADataState> = (state = initialState, action: DataAct
};
}
case LOAD_SA_DATA_FAILURE: {
return {
...state,
isFetching: false,
};
window.location.href = '/login';
break;
}
case LOAD_SA_DATA_SUCCESS: {
const {connectors} = action.payload;
Expand Down
3 changes: 3 additions & 0 deletions src/webui/frontend/src/reducers/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ export const rules: Reducer<SnowAlertRulesState> = (
.map(r => new Suppression(Object.assign(r, {savedBody: r.body}))),
isFetching: false,
};
case RulesActions.LOAD_SNOWALERT_RULES_FAILURE: {
window.location.href = '/login';
}

// saving rules
case RulesActions.SAVE_RULE_REQUEST:
Expand Down

0 comments on commit 3fe911e

Please sign in to comment.