Skip to content

Commit

Permalink
Image upload: add error message
Browse files Browse the repository at this point in the history
FETCH_ERROR is used, for the moment, when dragging and dropping an external image and a CORS issue happens
  • Loading branch information
yaaax committed Oct 23, 2024
1 parent 0934488 commit c869c50
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion confiture-web-app/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ export enum Browsers {
EDGE = "Microsoft Edge"
}

/* UPLOAD_FORMAT should never happen… */
export enum FileErrorMessage {
UPLOAD_SIZE = "Votre fichier dépasse la limite de 2 Mo. Veuillez choisir un fichier plus léger.",
UPLOAD_FORMAT = "Format de fichier non supporté.",
UPLOAD_FORMAT_EXAMPLE = "Format de fichier non supporté. Veuillez choisir un fichier jpg, jpeg ou png.",
FETCH_ERROR = "Impossible de récupérer le fichier distant",
UPLOAD_UNKNOWN = "Une erreur inconnue empêche le téléchargement du fichier. Veuillez réessayer.",
DELETE_UNKNOWN = "Une erreur inconnue empêche la suppression du fichier. Veuillez réessayer."
}
1 change: 1 addition & 0 deletions confiture-web-app/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export async function handleFileUploadError(
}

// Unprocessable Entity
/* UPLOAD_FORMAT should never happen… */
if (error.response.status === 422) {
const body = await error.response.json();

Expand Down

0 comments on commit c869c50

Please sign in to comment.