48 lines
897 B
TypeScript
48 lines
897 B
TypeScript
|
|
export const glsWithCatch = (key: string) => {
|
||
|
|
try {
|
||
|
|
return localStorage?.getItem(key);
|
||
|
|
} catch (error) {
|
||
|
|
console.log(error);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
export const slsWithCatch = (key: string, value: any) => {
|
||
|
|
try {
|
||
|
|
localStorage?.setItem(key, value);
|
||
|
|
} catch (error) {
|
||
|
|
console.log(error);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
export const rlsWithCatch = (key: string) => {
|
||
|
|
try {
|
||
|
|
localStorage?.removeItem(key);
|
||
|
|
} catch (error) {
|
||
|
|
console.log(error);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
export const gssWithCatch = (key: string) => {
|
||
|
|
try {
|
||
|
|
return sessionStorage?.getItem(key);
|
||
|
|
} catch (error) {
|
||
|
|
console.log(error);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
export const sssWithCatch = (key: string, value: any) => {
|
||
|
|
try {
|
||
|
|
sessionStorage?.setItem(key, value);
|
||
|
|
} catch (error) {
|
||
|
|
console.log(error);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
export const rssWithCatch = (key: string) => {
|
||
|
|
try {
|
||
|
|
sessionStorage?.removeItem(key);
|
||
|
|
} catch (error) {
|
||
|
|
console.log(error);
|
||
|
|
}
|
||
|
|
};
|