Skip to content

Commit

Permalink
Fix: Reset macros in config settings (#637)
Browse files Browse the repository at this point in the history
* Fix: Reset macros in config settings
* Fix: Change the writing of async functions
  • Loading branch information
bbaa77770 authored Dec 17, 2020
1 parent a9e976f commit ad433dd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/app/containers/Settings/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,13 @@ class Settings extends PureComponent {
},
// Workspace
config: {
restoreDefaults: () => {
confirm({
restoreDefaults: async () => {
await confirm({
title: i18n._('Reset All User Settings'),
body: i18n._('Are you sure you want to restore the default settings?')
}).then(() => {
this.props.resetAllUserSettings();
window.location.reload();
});
await this.props.resetAllUserSettings();
window.location.reload();
}
},
// About
Expand Down
11 changes: 11 additions & 0 deletions src/app/flux/setting/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ import { actions as projectActions } from '../project';

export const actions = {
resetAllUserSettings: () => async (dispatch) => {
// macros
try {
let res = await api.macros.fetch();
const { records: macros } = res.body;
for (const macro of macros) {
res = await api.macros.delete(macro.id);
}
} catch (err) {
//Ignore error
}

// api.removeElectronData();
dispatch(projectActions.cleanAllRecentFiles());
// remove recovery modelState
Expand Down

0 comments on commit ad433dd

Please sign in to comment.