mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-26 23:24:38 +02:00
⚡ Closes modal agter apply, and adds error toast
This commit is contained in:
parent
f2e477811f
commit
1fe3909cd6
@ -26,7 +26,7 @@
|
|||||||
import Button from '@/components/FormElements/Button';
|
import Button from '@/components/FormElements/Button';
|
||||||
import { languages } from '@/utils/languages';
|
import { languages } from '@/utils/languages';
|
||||||
import SaveConfigIcon from '@/assets/interface-icons/save-config.svg';
|
import SaveConfigIcon from '@/assets/interface-icons/save-config.svg';
|
||||||
import { localStorageKeys } from '@/utils/defaults';
|
import { localStorageKeys, modalNames } from '@/utils/defaults';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'LanguageSwitcher',
|
name: 'LanguageSwitcher',
|
||||||
@ -39,10 +39,11 @@ export default {
|
|||||||
return {
|
return {
|
||||||
availibleLanguages: languages,
|
availibleLanguages: languages,
|
||||||
language: '',
|
language: '',
|
||||||
|
modalName: modalNames.LANG_SWITCHER,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/* Save language to local storage */
|
/* Save language to local storage, show success msg and close modal */
|
||||||
saveLanguage() {
|
saveLanguage() {
|
||||||
const selectedLanguage = this.language;
|
const selectedLanguage = this.language;
|
||||||
if (this.checkLocale(selectedLanguage)) {
|
if (this.checkLocale(selectedLanguage)) {
|
||||||
@ -51,6 +52,9 @@ export default {
|
|||||||
const successMsg = `${selectedLanguage.flag} `
|
const successMsg = `${selectedLanguage.flag} `
|
||||||
+ `${this.$t('language-switcher.success-msg')} ${selectedLanguage.name}`;
|
+ `${this.$t('language-switcher.success-msg')} ${selectedLanguage.name}`;
|
||||||
this.$toasted.show(successMsg, { className: 'toast-success' });
|
this.$toasted.show(successMsg, { className: 'toast-success' });
|
||||||
|
this.$modal.hide(this.modalName);
|
||||||
|
} else {
|
||||||
|
this.$toasted.show('Unable to update language', { className: 'toast-error' });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* Check language is supported, before saving */
|
/* Check language is supported, before saving */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user