This commit is contained in:
wenyann 2020-05-14 19:11:31 +08:00
parent 1252568220
commit c066d99492
2 changed files with 4 additions and 13 deletions

View File

@ -1,4 +1,5 @@
export const TokenKey = 'Admin-Token'; export const TokenKey = 'Admin-Token';
export const DEFAULT_LANGUAGE = 'default_language';
export const ROLE_ADMIN = 'admin'; export const ROLE_ADMIN = 'admin';
export const ROLE_ORG_ADMIN = 'org_admin'; export const ROLE_ORG_ADMIN = 'org_admin';

View File

@ -42,7 +42,7 @@
<script> <script>
import {saveLocalStorage} from '../common/js/utils'; import {saveLocalStorage} from '../common/js/utils';
import {TokenKey} from "../common/js/constants"; import {DEFAULT_LANGUAGE} from "../common/js/constants";
export default { export default {
@ -111,8 +111,8 @@
if (!language) { if (!language) {
this.$get("language", response => { this.$get("language", response => {
language = response.data language = response.data;
this.changeLanguage(); localStorage.setItem(DEFAULT_LANGUAGE, language)
}) })
} }
window.location.href = "/" window.location.href = "/"
@ -121,16 +121,6 @@
return false; return false;
} }
}); });
},
changeLanguage(language) {
let user = {
id: this.currentUser().id,
language: language
};
this.checkLanguage(language);
this.result = this.$post("/user/update/current", user, response => {
localStorage.setItem(TokenKey, JSON.stringify(response.data));
});
} }
} }
} }