mirror of
https://github.com/romancm/gamebrary
synced 2025-02-17 11:38:24 +00:00
Settings clean up
This commit is contained in:
parent
00c1465d9b
commit
aacf22514b
1 changed files with 8 additions and 18 deletions
|
@ -48,6 +48,12 @@ export default {
|
|||
reloading: false,
|
||||
localSettings: null,
|
||||
moment,
|
||||
defaultSettings: {
|
||||
language: 'en',
|
||||
theme: {
|
||||
global: 'theme-default',
|
||||
},
|
||||
},
|
||||
settingsSections: [
|
||||
{
|
||||
name: 'global',
|
||||
|
@ -125,28 +131,12 @@ export default {
|
|||
mounted() {
|
||||
this.localSettings = this.settings !== null
|
||||
? JSON.parse(JSON.stringify(this.settings))
|
||||
: {};
|
||||
|
||||
// this.localSettings.theme = {};
|
||||
|
||||
// console.log(this.localSettings);
|
||||
|
||||
this.language = (this.localSettings && this.localSettings.language) || 'en';
|
||||
|
||||
switch (this.$route.name) {
|
||||
case 'game-board': this.openSettings({ name: 'gameBoard', component: 'GameBoardSettings' }); break;
|
||||
case 'platforms': this.openSettings({ name: 'platforms', component: 'PlatformsSettings' }); break;
|
||||
default: this.openSettings(this.settingsSections[0]);
|
||||
}
|
||||
: JSON.parse(JSON.stringify(this.defaultSettings));
|
||||
},
|
||||
|
||||
methods: {
|
||||
openSettings({ component, name }) {
|
||||
this.activeComponent = component;
|
||||
this.activeSection = name;
|
||||
},
|
||||
|
||||
save() {
|
||||
// TODO: call action directly
|
||||
this.$bus.$emit('SAVE_SETTINGS', this.localSettings);
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue