Remove Safe owners from storage
This commit is contained in:
parent
654cc5a0d7
commit
34aa15bee8
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { type Owner } from '~/routes/safe/store/models/owner'
|
import { type Owner } from '~/routes/safe/store/models/owner'
|
||||||
import { List, Map } from 'immutable'
|
import { List, Map } from 'immutable'
|
||||||
import { loadFromStorage, saveToStorage } from '~/utils/storage'
|
import { loadFromStorage, saveToStorage, removeFromStorage } from '~/utils/storage'
|
||||||
|
|
||||||
export const SAFES_KEY = 'SAFES'
|
export const SAFES_KEY = 'SAFES'
|
||||||
export const TX_KEY = 'TX'
|
export const TX_KEY = 'TX'
|
||||||
|
@ -41,3 +41,12 @@ export const getOwners = async (safeAddress: string): Map<string, string> => {
|
||||||
|
|
||||||
return data ? Map(data) : Map()
|
return data ? Map(data) : Map()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const removeOwners = async (safeAddress: string): Map<string, string> => {
|
||||||
|
try {
|
||||||
|
await removeFromStorage(`${OWNERS_KEY}-${safeAddress}`)
|
||||||
|
} catch (err) {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
console.log('Error removing owners from localstorage')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -31,3 +31,11 @@ export const saveToStorage = async (key: string, value: *): Promise<*> => {
|
||||||
console.error(`Failed to save ${key} in the storage:`, err)
|
console.error(`Failed to save ${key} in the storage:`, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const removeFromStorage = async (key: string): Promise<*> => {
|
||||||
|
try {
|
||||||
|
await storage.remove(`${PREFIX}__${key}`)
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Failed to remove ${key} from the storage:`, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue