add prettier
This commit is contained in:
1 parent
6a9a45a4cc
commit
07fc6c0b6c
35 files changed
+530
-461
No files matched your search
@@ -1,12 +1,15 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
config?: any;
|
||||
}
|
||||
interface Window {
|
||||
config?: any
|
||||
}
|
||||
}
|
||||
|
||||
export const getConfigProperty = (property: string, defaultValue: any) => {
|
||||
if (window.config && Object.prototype.hasOwnProperty.call(window.config, property)) {
|
||||
return window.config[property];
|
||||
}
|
||||
return defaultValue;
|
||||
};
|
||||
if (
|
||||
window.config &&
|
||||
Object.prototype.hasOwnProperty.call(window.config, property)
|
||||
) {
|
||||
return window.config[property]
|
||||
}
|
||||
return defaultValue
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
export const LocalStorage = {
|
||||
set(key: string, value: any): void {
|
||||
const item = typeof value === "string" ? value : JSON.stringify(value);
|
||||
localStorage.setItem(key, item);
|
||||
},
|
||||
get(key: string): any | null {
|
||||
const value = localStorage.getItem(key);
|
||||
try {
|
||||
return value ? JSON.parse(value) : null;
|
||||
} catch (error) {
|
||||
return value;
|
||||
}
|
||||
},
|
||||
remove(key: string): void {
|
||||
localStorage.removeItem(key);
|
||||
},
|
||||
clear(): void {
|
||||
localStorage.clear();
|
||||
},
|
||||
};
|
||||
set(key: string, value: any): void {
|
||||
const item = typeof value === 'string' ? value : JSON.stringify(value)
|
||||
localStorage.setItem(key, item)
|
||||
},
|
||||
get(key: string): any | null {
|
||||
const value = localStorage.getItem(key)
|
||||
try {
|
||||
return value ? JSON.parse(value) : null
|
||||
} catch (error) {
|
||||
return value
|
||||
}
|
||||
},
|
||||
remove(key: string): void {
|
||||
localStorage.removeItem(key)
|
||||
},
|
||||
clear(): void {
|
||||
localStorage.clear()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user