mirror of
https://github.com/mue/mue.git
synced 2026-07-15 21:13:54 +02:00
fix: some bug fixes
This commit is contained in:
@@ -64,7 +64,7 @@ export default class About extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (localStorage.getItem('offlineMode') === 'true') {
|
||||
if (navigator.onLine === false || localStorage.getItem('offlineMode') === 'true') {
|
||||
this.setState({
|
||||
update: this.language.version.offline_mode
|
||||
});
|
||||
|
||||
@@ -22,9 +22,9 @@ export default class AdvancedSettings extends React.PureComponent {
|
||||
settingsImport(e) {
|
||||
const content = JSON.parse(e.target.result);
|
||||
|
||||
for (const key of Object.keys(content)) {
|
||||
Object.keys(content).forEach((key) => {
|
||||
localStorage.setItem(key, content[key]);
|
||||
}
|
||||
});
|
||||
|
||||
toast(window.language.toasts.imported);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export default class Changelog extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (localStorage.getItem('offlineMode') === 'true') {
|
||||
if (navigator.onLine || localStorage.getItem('offlineMode') === 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ export default class OrderSettings extends React.PureComponent {
|
||||
items: JSON.parse(localStorage.getItem('order'))
|
||||
});
|
||||
|
||||
toast(this.language.toasts.reset);
|
||||
toast(window.language.toasts.reset);
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
|
||||
@@ -30,18 +30,12 @@ export default class BackgroundSettings extends React.PureComponent {
|
||||
this.setState({
|
||||
customBackground: ''
|
||||
});
|
||||
toast(this.language.toasts.reset);
|
||||
toast(window.language.toasts.reset);
|
||||
EventBus.dispatch('refresh', 'background');
|
||||
}
|
||||
|
||||
customBackground(e, text) {
|
||||
let result;
|
||||
if (text === true) {
|
||||
result = e.target.value;
|
||||
} else {
|
||||
result = e.target.result;
|
||||
}
|
||||
|
||||
const result = (text === true) ? e.target.value : e.target.result;
|
||||
localStorage.setItem('customBackground', result);
|
||||
this.setState({
|
||||
customBackground: result
|
||||
@@ -83,6 +77,10 @@ export default class BackgroundSettings extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (navigator.onLine === false || localStorage.getItem('offlineMode') === 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
this.getBackgroundCategories();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user