mirror of
https://github.com/mue/mue.git
synced 2026-07-12 19:52:53 +02:00
refactor(modules): second part of moving files around, changing layout etc
This commit is contained in:
18
src/utils/settings/import.js
Normal file
18
src/utils/settings/import.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import { toast } from 'react-toastify';
|
||||
import variables from 'config/variables';
|
||||
|
||||
/**
|
||||
* It takes a JSON file of Mue settings, parses it, and then sets the localStorage values to the values in the
|
||||
* file.
|
||||
* @param e - The JSON settings string to import
|
||||
*/
|
||||
export function importSettings(e) {
|
||||
const content = JSON.parse(e);
|
||||
|
||||
Object.keys(content).forEach((key) => {
|
||||
localStorage.setItem(key, content[key]);
|
||||
});
|
||||
|
||||
toast(variables.getMessage('toasts.imported'));
|
||||
variables.stats.postEvent('tab', 'Settings imported');
|
||||
}
|
||||
Reference in New Issue
Block a user