Show an error if a user attempts to upload a folder

This commit is contained in:
DaneEveritt 2022-07-24 18:22:50 -04:00
parent 1d5d92f678
commit 1cfa4100ad
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 27 additions and 39 deletions

View file

@ -3,6 +3,7 @@ import { FlashStore } from '@/state/flashes';
import { ApplicationStore } from '@/state';
interface KeyedFlashStore {
addError: (message: string, title?: string) => void;
clearFlashes: () => void;
clearAndAddHttpError: (error?: Error | string | null) => void;
}
@ -12,9 +13,10 @@ const useFlash = (): Actions<FlashStore> => {
};
const useFlashKey = (key: string): KeyedFlashStore => {
const { clearFlashes, clearAndAddHttpError } = useFlash();
const { addFlash, clearFlashes, clearAndAddHttpError } = useFlash();
return {
addError: (message, title) => addFlash({ key, message, title, type: 'error' }),
clearFlashes: () => clearFlashes(key),
clearAndAddHttpError: (error) => clearAndAddHttpError({ key, error }),
};