Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Reset macros in config settings #637

Merged
merged 2 commits into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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