[Enterprise Search] Add a helper for clearFlashMessages (#87383)

This PR adds a convenience function for clearing flash messages to align with others.
This commit is contained in:
Scotty Bollinger 2021-01-05 16:54:44 -06:00 committed by GitHub
parent b0ba4f47ab
commit 3e3a809b4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View file

@ -12,4 +12,5 @@ export {
setErrorMessage,
setQueuedSuccessMessage,
setQueuedErrorMessage,
clearFlashMessages,
} from './set_message_helpers';

View file

@ -16,6 +16,7 @@ import {
setErrorMessage,
setQueuedSuccessMessage,
setQueuedErrorMessage,
clearFlashMessages,
} from './';
describe('Flash Message Helpers', () => {
@ -68,4 +69,10 @@ describe('Flash Message Helpers', () => {
},
]);
});
it('clearFlashMessages()', () => {
clearFlashMessages();
expect(FlashMessagesLogic.values.messages).toEqual([]);
});
});

View file

@ -33,3 +33,7 @@ export const setQueuedErrorMessage = (message: string) => {
message,
});
};
export const clearFlashMessages = () => {
FlashMessagesLogic.actions.clearFlashMessages();
};