blob: b89dd9243970186dbfab1a30281e791dcade197a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
const getAddress = () => {
if (typeof window !== 'undefined') {
const address = localStorage.getItem('address')
if (address) return JSON.parse(address)
}
return {}
}
const setAddress = (address) => {
if (typeof window !== 'undefined') {
localStorage.setItem('address', JSON.stringify(address))
}
return
}
const getItemAddress = (key) => {
let address = getAddress()
return address[key]
}
const updateItemAddress = (key, value) => {
let address = getAddress()
address[key] = value
setAddress(address)
return
}
export {
getItemAddress,
updateItemAddress
}
|