fix: some bug fixes

This commit is contained in:
David Ralph
2021-04-21 19:35:33 +01:00
parent 9b43063935
commit 51d0715f0f
22 changed files with 49 additions and 38 deletions

View File

@@ -23,10 +23,9 @@ const saveFile = (data, filename = 'file') => {
export default class SettingsFunctions {
static exportSettings() {
let settings = {};
for (const key of Object.keys(localStorage)) {
Object.keys(localStorage).forEach((key) => {
settings[key] = localStorage.getItem(key);
}
});
saveFile(settings, 'mue-settings.json');
}
@@ -160,15 +159,17 @@ export default class SettingsFunctions {
`);
}
// in a nutshell, this function saves all of the current settings, resets them, sets the defaults and then overrides
// the new settings with the old saved messages where they exist
static moveSettings() {
if (Object.keys(localStorage).length === 0) {
return this.setDefaultSettings();
}
let settings = {};
for (const key of Object.keys(localStorage)) {
Object.keys(localStorage).forEach((key) => {
settings[key] = localStorage.getItem(key);
}
});
localStorage.clear();