Skip to content

Commit

Permalink
display error message for duplicate flag
Browse files Browse the repository at this point in the history
  • Loading branch information
finlay-jisc committed Oct 17, 2023
1 parent 4dd6c40 commit 7729bc6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ui/src/components/Publication/SidebarCard/Actions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import * as Assets from '@assets';
import * as Types from '@types';
import * as api from '@api';

import axios from 'axios';

type ActionProps = {
publicationVersion: Interfaces.PublicationVersion;
};
Expand Down Expand Up @@ -68,7 +70,11 @@ const Actions: React.FC<ActionProps> = (props): React.ReactElement => {
}
} catch (err) {
const { message } = err as Interfaces.JSONResponseError;
setError(message);
setError(
axios.isAxiosError(err) && typeof err.response?.data?.message === 'string'
? err.response.data.message
: message
);
}
setSubmitting(false);
};
Expand Down

0 comments on commit 7729bc6

Please sign in to comment.