2023-06-15 12:52:46 +03:00
|
|
|
/* eslint-disable */
|
2023-06-02 18:01:49 +03:00
|
|
|
import { BrainConfig } from "../types";
|
|
|
|
|
|
|
|
const BRAIN_CONFIG_LOCAL_STORAGE_KEY = "userBrainConfig";
|
|
|
|
|
|
|
|
export const saveBrainConfigInLocalStorage = (updatedConfig: BrainConfig) => {
|
|
|
|
localStorage.setItem(
|
|
|
|
BRAIN_CONFIG_LOCAL_STORAGE_KEY,
|
|
|
|
JSON.stringify(updatedConfig)
|
|
|
|
);
|
|
|
|
};
|
|
|
|
export const getBrainConfigFromLocalStorage = (): BrainConfig | undefined => {
|
|
|
|
const persistedBrainConfig = localStorage.getItem(
|
|
|
|
BRAIN_CONFIG_LOCAL_STORAGE_KEY
|
|
|
|
);
|
2023-06-15 12:52:46 +03:00
|
|
|
if (persistedBrainConfig === null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-06-02 18:01:49 +03:00
|
|
|
return JSON.parse(persistedBrainConfig);
|
|
|
|
};
|