mirror of
https://github.com/status-im/safe-react.git
synced 2025-01-14 03:54:11 +00:00
Add types
This commit is contained in:
parent
bcb468e3ec
commit
3283bf1dc6
@ -10,7 +10,7 @@ export const storage = new ImmortalStorage(stores)
|
|||||||
|
|
||||||
const PREFIX = `v2_${getNetwork()}`
|
const PREFIX = `v2_${getNetwork()}`
|
||||||
|
|
||||||
export const loadFromStorage = async (key) => {
|
export const loadFromStorage = async (key: string): Promise<any> => {
|
||||||
try {
|
try {
|
||||||
const stringifiedValue = await storage.get(`${PREFIX}__${key}`)
|
const stringifiedValue = await storage.get(`${PREFIX}__${key}`)
|
||||||
if (stringifiedValue === null || stringifiedValue === undefined) {
|
if (stringifiedValue === null || stringifiedValue === undefined) {
|
||||||
@ -24,7 +24,7 @@ export const loadFromStorage = async (key) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const saveToStorage = async (key, value) => {
|
export const saveToStorage = async (key: string, value: any): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
const stringifiedValue = JSON.stringify(value)
|
const stringifiedValue = JSON.stringify(value)
|
||||||
await storage.set(`${PREFIX}__${key}`, stringifiedValue)
|
await storage.set(`${PREFIX}__${key}`, stringifiedValue)
|
||||||
@ -33,7 +33,7 @@ export const saveToStorage = async (key, value) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const removeFromStorage = async (key) => {
|
export const removeFromStorage = async (key: string): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
await storage.remove(`${PREFIX}__${key}`)
|
await storage.remove(`${PREFIX}__${key}`)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user