From b61b79923552bd0e22ddd6a16ee9d424248b469b Mon Sep 17 00:00:00 2001 From: Florian Dupret <34862846+sephrat@users.noreply.github.com> Date: Thu, 29 Apr 2021 09:53:42 +0200 Subject: [PATCH] Refactor log-in API texts handling --- frontend/src/api/users.js | 11 ++++++----- frontend/src/components/Login/LoginForm.vue | 15 +++------------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/frontend/src/api/users.js b/frontend/src/api/users.js index 9081398cd..33043c7b5 100644 --- a/frontend/src/api/users.js +++ b/frontend/src/api/users.js @@ -30,11 +30,12 @@ function deleteErrorText(response) { } export const userAPI = { async login(formData) { - let response = await apiReq.post(authURLs.token, formData, { - headers: { - "Content-Type": "application/x-www-form-urlencoded", - }, - }); + let response = await apiReq.post( + authURLs.token, + formData, + function() { return i18n.t('user.incorrect-username-or-password'); }, + function() { return i18n.t('user.user-successfully-logged-in'); } + ); return response; }, async refresh() { diff --git a/frontend/src/components/Login/LoginForm.vue b/frontend/src/components/Login/LoginForm.vue index 63ba2c768..52eca4c54 100644 --- a/frontend/src/components/Login/LoginForm.vue +++ b/frontend/src/components/Login/LoginForm.vue @@ -61,7 +61,6 @@