From d2e56cf23396752a9879dc6bb7cdea135f2984bb Mon Sep 17 00:00:00 2001 From: sephrat <34862846+sephrat@users.noreply.github.com> Date: Fri, 30 Apr 2021 18:43:30 +0200 Subject: [PATCH 1/5] Api refactoring fixes (#372) * Fix JS error when logging in with bad credentials * Remove duplicate error message if bad credentials Error is already nicely displayed in LoginForm --- frontend/src/api/users.js | 2 +- frontend/src/components/Login/LoginForm.vue | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/api/users.js b/frontend/src/api/users.js index edf85bc3a..7d66798ee 100644 --- a/frontend/src/api/users.js +++ b/frontend/src/api/users.js @@ -32,7 +32,7 @@ export const userAPI = { let response = await apiReq.post( authURLs.token, formData, - function() { return i18n.t('user.incorrect-username-or-password'); }, + null, function() { return i18n.t('user.user-successfully-logged-in'); } ); return response; diff --git a/frontend/src/components/Login/LoginForm.vue b/frontend/src/components/Login/LoginForm.vue index 52eca4c54..4e66c3ac2 100644 --- a/frontend/src/components/Login/LoginForm.vue +++ b/frontend/src/components/Login/LoginForm.vue @@ -98,11 +98,10 @@ export default { this.clear(); this.$store.commit("setToken", response.data.access_token); this.$emit("logged-in"); + let user = await api.users.self(); + this.$store.commit("setUserData", user); } - let user = await api.users.self(); - this.$store.commit("setUserData", user); - this.loading = false; }, }, From b302e0ffd8994a20f382361983187eb352811e2c Mon Sep 17 00:00:00 2001 From: sephrat <34862846+sephrat@users.noreply.github.com> Date: Fri, 30 Apr 2021 18:44:03 +0200 Subject: [PATCH 2/5] More localization (#373) * Translate missing string * Display language in original language + English * Translate assets * Translate recipe settings --- .../src/components/Recipe/Parts/Assets.vue | 2 +- .../Recipe/Parts/Helpers/SettingsMenu.vue | 22 +++++++++++-------- .../src/components/UI/Dialogs/BaseDialog.vue | 4 ++-- frontend/src/components/UI/TheSiteMenu.vue | 2 +- frontend/src/locales/messages/en-US.json | 6 +++++ frontend/src/store/modules/language.js | 16 +++++++------- 6 files changed, 31 insertions(+), 21 deletions(-) diff --git a/frontend/src/components/Recipe/Parts/Assets.vue b/frontend/src/components/Recipe/Parts/Assets.vue index 65d4ec0ae..c8a094d5b 100644 --- a/frontend/src/components/Recipe/Parts/Assets.vue +++ b/frontend/src/components/Recipe/Parts/Assets.vue @@ -38,7 +38,7 @@