mirror of
https://github.com/EvolutionAPI/evolution-manager.git
synced 2025-07-13 15:14:49 -06:00
verify url before connect
This commit is contained in:
parent
303ede0ba1
commit
d10417960f
@ -33,7 +33,7 @@ export const useAppStore = defineStore('app', {
|
||||
async setConnection({ host, globalApiKey }) {
|
||||
try {
|
||||
this.connecting = true
|
||||
const responde = await axios({
|
||||
const response = await axios({
|
||||
method: 'GET',
|
||||
baseURL: host,
|
||||
headers: {
|
||||
@ -43,9 +43,11 @@ export const useAppStore = defineStore('app', {
|
||||
url: '/instance/fetchInstances'
|
||||
})
|
||||
|
||||
this.saveConnection({ host, globalApiKey })
|
||||
if (!response.data || !Array.isArray(response.data)) throw new Error('Essa conexão não é uma instância da evolution-api')
|
||||
|
||||
this.instancesList = responde.data
|
||||
|
||||
this.saveConnection({ host, globalApiKey })
|
||||
this.instancesList = response.data
|
||||
} catch (e) {
|
||||
this.connection.valid = false
|
||||
throw e.response?.data?.response?.message || e.response || e
|
||||
|
Loading…
Reference in New Issue
Block a user