Remove types
This commit is contained in:
parent
cc6aa13451
commit
231a9a7d35
|
@ -17,15 +17,9 @@ import { buildSafe } from 'src/routes/safe/store/actions/fetchSafe'
|
||||||
import { history } from 'src/store'
|
import { history } from 'src/store'
|
||||||
import { loadFromStorage } from 'src/utils/storage'
|
import { loadFromStorage } from 'src/utils/storage'
|
||||||
import { Dispatch } from 'redux'
|
import { Dispatch } from 'redux'
|
||||||
import { SafeOwner, SafeRecordProps } from '../../safe/store/models/safe'
|
import { SafeOwner } from '../../safe/store/models/safe'
|
||||||
import { List } from 'immutable'
|
import { List } from 'immutable'
|
||||||
|
|
||||||
type RecordPropType = Partial<SafeRecordProps>
|
|
||||||
|
|
||||||
type StoredSafesType = {
|
|
||||||
[address: string]: RecordPropType
|
|
||||||
}
|
|
||||||
|
|
||||||
export const loadSafe = async (
|
export const loadSafe = async (
|
||||||
safeName: string,
|
safeName: string,
|
||||||
safeAddress: string,
|
safeAddress: string,
|
||||||
|
@ -35,7 +29,7 @@ export const loadSafe = async (
|
||||||
const safeProps = await buildSafe(safeAddress, safeName)
|
const safeProps = await buildSafe(safeAddress, safeName)
|
||||||
safeProps.owners = owners
|
safeProps.owners = owners
|
||||||
|
|
||||||
const storedSafes: StoredSafesType = (await loadFromStorage(SAFES_KEY)) || {}
|
const storedSafes = (await loadFromStorage(SAFES_KEY)) || {}
|
||||||
|
|
||||||
storedSafes[safeAddress] = safeProps
|
storedSafes[safeAddress] = safeProps
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ export const storage = new ImmortalStorage(stores)
|
||||||
|
|
||||||
const PREFIX = `v2_${getNetwork()}`
|
const PREFIX = `v2_${getNetwork()}`
|
||||||
|
|
||||||
export const loadFromStorage = async (key: string) => {
|
export const loadFromStorage = async <T extends () => unknown>(key: string): Promise<T> => {
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in New Issue