Skip to content

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkorotkov committed May 20, 2022
1 parent e6e1263 commit 7f25243
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/store/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@ import ls from 'local-storage'
import API from '../api/elasticsearch'
import { trackEvent } from '../utils/analitycs'

const initial = {
name: 'Local Server',
host: 'http://localhost',
port: '9200',
useAuth: false,
user: '',
password: '',
addHeaders: false,
headers: [{ name: '', value: '' }],
}

export const connection = store => {
store.on('@init', () => {
const connections = ls('connection') || []

if (connections.length)
return { connection: connections[connections.length - 1] }
return { connection: {...initial, ...connections[connections.length - 1]} }

return {
connection: {
name: 'Local Server',
host: 'http://localhost',
port: '9200',
useAuth: false,
user: '',
password: '',
addHeaders: false,
headers: [{ name: '', value: '' }],
},
connection: initial,
}
})

Expand All @@ -34,7 +36,7 @@ export const connection = store => {
user: '',
password: '',
addHeaders: false,
headers: [],
headers: [{ name: '', value: '' }],
},
}
})
Expand Down

0 comments on commit 7f25243

Please sign in to comment.