typing loadFromStorage wip
This commit is contained in:
parent
231a9a7d35
commit
18f03b8bc1
|
@ -10,10 +10,10 @@ const watchedActions = [ADD_PROVIDER, REMOVE_PROVIDER]
|
|||
|
||||
const LAST_USED_PROVIDER_KEY = 'LAST_USED_PROVIDER'
|
||||
|
||||
export const loadLastUsedProvider = async () => {
|
||||
const lastUsedProvider = await loadFromStorage(LAST_USED_PROVIDER_KEY)
|
||||
export const loadLastUsedProvider = async (): Promise<string | undefined> => {
|
||||
const lastUsedProvider = await loadFromStorage<string>(LAST_USED_PROVIDER_KEY)
|
||||
|
||||
return lastUsedProvider || ''
|
||||
return lastUsedProvider
|
||||
}
|
||||
|
||||
let watcherInterval = null
|
||||
|
|
|
@ -10,7 +10,7 @@ export const storage = new ImmortalStorage(stores)
|
|||
|
||||
const PREFIX = `v2_${getNetwork()}`
|
||||
|
||||
export const loadFromStorage = async <T extends () => unknown>(key: string): Promise<T> => {
|
||||
export const loadFromStorage = async <T extends unknown>(key: string): Promise<T | undefined> => {
|
||||
try {
|
||||
const stringifiedValue = await storage.get(`${PREFIX}__${key}`)
|
||||
if (stringifiedValue === null || stringifiedValue === undefined) {
|
||||
|
|
Loading…
Reference in New Issue