Skip to content

Commit

Permalink
Fixed error message on timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Oct 25, 2021
1 parent 006b7fb commit 1fcda55
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions backend/src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ message.invalid-signing=Unless the response or the assertions are signed, SAML s

message.session-timeout-heading=Session timed out
message.session-timeout-body=Your session has timed out. Please login again.
message.session-timeout=An error has occurred while saving. Your session may have timed out.

tooltip.entity-id=Entity ID
tooltip.service-provider-name=Service Provider Name (Dashboard Display Only)
Expand Down
14 changes: 11 additions & 3 deletions ui/src/app/metadata/view/MetadataWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import { Wizard } from '../wizard/Wizard';
import { useMetadataEntity } from '../hooks/api';
import { createNotificationAction, NotificationTypes, useNotificationDispatcher } from '../../notifications/hoc/Notifications';
import { Prompt, useHistory } from 'react-router';
import { useTranslator } from '../../i18n/hooks';

export function MetadataWizard ({type, data, onCallback}) {

const history = useHistory();
const translator = useTranslator();

const { post, loading, response } = useMetadataEntity(type === 'source' ? 'source' : 'provider');

Expand All @@ -19,15 +21,21 @@ export function MetadataWizard ({type, data, onCallback}) {
const [blocking, setBlocking] = React.useState(false);

async function save(metadata) {
console.log(metadata);
await post('', metadata);
if (response.ok) {
setBlocking(false);
history.push(`/dashboard/metadata/manager/${type === 'source' ? 'resolvers' : 'providers'}`);
} else {
const { errorCode, errorMessage, cause } = response.data;
let msg;
if (response.status) {
const { errorCode, errorMessage, cause } = response.data;
msg = `${errorCode}: ${errorMessage} ${cause ? `-${cause}` : ''}`;
} else {
msg = translator('message.session-timeout');
}

notificationDispatch(createNotificationAction(
`${errorCode}: ${errorMessage} ${cause ? `-${cause}` : ''}`,
msg,
NotificationTypes.ERROR
));
}
Expand Down

0 comments on commit 1fcda55

Please sign in to comment.