mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-17 20:17:02 +01:00
Add config loader tools
This commit is contained in:
16
tools/config.ts
Normal file
16
tools/config.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export function loadConfig(path: string): Config | null {
|
||||
const item = localStorage.getItem(path);
|
||||
if (!item) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return JSON.parse(item) as Config;
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
searchBar: boolean,
|
||||
}
|
||||
Reference in New Issue
Block a user