mirror of
https://github.com/EasyTier/EasyTier.git
synced 2024-11-16 03:32:43 +08:00
networkList should not be empty after first start
This commit is contained in:
parent
2deb867678
commit
518b6e277a
|
@ -76,10 +76,15 @@ export const useNetworkStore = defineStore('networkStore', {
|
|||
let networkList: NetworkConfig[]
|
||||
|
||||
try {
|
||||
networkList = JSON.parse(localStorage.getItem('networkList') || '[]')
|
||||
networkList = JSON.parse(localStorage.getItem('networkList') || '[{}]')
|
||||
networkList = networkList.map((cfg) => {
|
||||
return { ...DEFAULT_NETWORK_CONFIG(), ...cfg } as NetworkConfig
|
||||
})
|
||||
|
||||
// prevent a empty list from localStorage, should not happen
|
||||
if (networkList.length === 0) {
|
||||
networkList = [DEFAULT_NETWORK_CONFIG()]
|
||||
}
|
||||
}
|
||||
catch {
|
||||
networkList = [DEFAULT_NETWORK_CONFIG()]
|
||||
|
|
Loading…
Reference in New Issue
Block a user