Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Commit

Permalink
Add flash message when notifications are reset
Browse files Browse the repository at this point in the history
  • Loading branch information
camwhit-e committed Apr 9, 2022
1 parent 9a95adb commit 6cc8e2b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default () => {
const [ isSubmitting, setIsSubmitting ] = useState(false);
const [ notifications, setNotifications ] = useState<Notification[]>([]);

const { addError, clearFlashes } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes);
const { addError, addFlash, clearFlashes } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes);

useEffect(() => {
clearFlashes('account');
Expand All @@ -38,6 +38,11 @@ export default () => {
setIsSubmitting(true);
deleteNotifications()
.then(() => setIsSubmitting(false))
.then(() => addFlash({
type: 'success',
key: 'account:notifications',
message: 'Notifications have been cleared, please refresh the page.',
}))
.catch(error => {
addError({ key: 'account:notifications', message: httpErrorToHuman(error) });
});
Expand Down

0 comments on commit 6cc8e2b

Please sign in to comment.