Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alert user if they do not have permission to see bids #1574

Merged
merged 3 commits into from
Jul 1, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/actions/bureauPositionBids.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ export function bureauBidsAllFetchData(id, query) {
dispatch(bureauPositionBidsAllHasErrored(false));
dispatch(bureauPositionBidsAllIsLoading(false));
})
.catch(() => {
.catch((err) => {
if (err.response.status === 403) {
dispatch(toastError('You do not have the bureau or organization permissions associated with this position. Bidders will be hidden.', 'Insufficient Permissions'));
}
dispatch(bureauPositionBidsAllHasErrored(true));
dispatch(bureauPositionBidsAllIsLoading(false));
});
Expand Down Expand Up @@ -216,9 +219,14 @@ export function downloadBidderData(id, query = {}) {
.then((response) => {
downloadFromResponse(response, 'TalentMap_position_bids');
})
.catch(() => {
// eslint-disable-next-line global-require
require('../store').store.dispatch(toastError('Export unsuccessful. Please try again.', 'Error exporting'));
.catch((err) => {
/* eslint-disable global-require */
if (err.response.status === 403) {
require('../store').store.dispatch(toastError('You do not have the bureau or organization permissions associated with this position.', 'Insufficient Permissions'));
} else {
require('../store').store.dispatch(toastError('Export unsuccessful. Please try again.', 'Error exporting'));
}
/* eslint-enable global-require */
});
}

Expand Down