-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ChoixTechno): add axios listing
- Loading branch information
Showing
2 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
try { | ||
const response: SearchExerciseResponse = await this.app.$axios.$post('/api/search', newSearchRequest); | ||
commit('INIT', response); | ||
} catch (e) { | ||
const errorAxios = e as AxiosError; | ||
|
||
if (errorAxios.response) { | ||
const status: number = errorAxios.response.status; | ||
|
||
if (status === 400) { | ||
this.$displayError("Une erreur est survenue lors du chargement des exercices.", {statusCode: status}); | ||
} else if (status === 401) { | ||
this.$displayError(`Vous devez vous connecter pour charger ces exercices.`, {statusCode: status}); | ||
} else if (status === 403) { | ||
this.$displayError(`Vous n'êtes pas autorisé à effectuer cette action.`, {statusCode: status}); | ||
} else if (status === 500) { | ||
this.$displayError(`Une erreur est survenue depuis nos serveurs, veuillez-nous en excuser.`, {statusCode: status}); | ||
} else { | ||
this.$displayError("Une erreur est survenue lors du chargement des exercices.", {statusCode: status}); | ||
} | ||
} else { | ||
this.$displayError(`Une erreur est survenue lors du chargement des exercices.`, {statusCode: 400}); | ||
} | ||
|
||
commit('RESET') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters