nomenclators.js 2.09 KB
Newer Older
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
1
import axios from 'axios'
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
2
import store from '@/store'
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
3 4 5 6 7 8
import { REQUEST_DIR } from '../utils/constants'
import { requestData } from './requestHeadersHelper'

export async function getCategories () {
  const url = `${REQUEST_DIR}nomenclador/categoria`
  const response = await axios.get(url, requestData())
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
9 10
  const categories = response.data
  store.commit('setCategories', categories)
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
11 12 13 14 15
  return response
}
export async function getAntigenos () {
  const url = `${REQUEST_DIR}nomenclador/antigeno`
  const response = await axios.get(url, requestData())
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
16 17
  const antigens = response.data
  store.commit('setAntigens', antigens)
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
18 19 20 21 22
  return response
}
export async function getSystemStatus () {
  const url = `${REQUEST_DIR}nomenclador/sistema`
  const response = await axios.get(url, requestData())
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
23
  store.commit('setSystemStatuses', response.data)
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
24 25 26
  return response
}
export async function getHealthStatus () {
27
  const url = `${REQUEST_DIR}nomenclador/salud`
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
28
  const response = await axios.get(url, requestData())
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
29 30
  const health = response.data
  store.commit('setHealthStatuses', health)
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
31 32 33 34 35
  return response
}
export async function getProvinces () {
  const url = `${REQUEST_DIR}nomenclador/provincia`
  const response = await axios.get(url, requestData())
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
36 37
   const provinces = response.data
   store.commit('setProvinces', provinces)
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
38 39
  return response
}
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
40
export async function getMunicipalities (id = 6) {
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
41 42
  const url = `${REQUEST_DIR}nomenclador/municipio/${id}`
  const response = await axios.get(url, requestData())
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
43 44 45 46 47
  const municipalities = response.data
  store.commit('setMunicipalities', municipalities)
  return response
}
export async function getClasifications () {
48
  const url = `${REQUEST_DIR}nomenclador/riesgo-categoria`
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
49 50 51
  const response = await axios.get(url, requestData())
  const clasifications = response.data
  store.commit('setClasifications', clasifications)
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
52 53 54 55 56
  return response
}
export async function getHealthAreas (id = 1) {
  const url = `${REQUEST_DIR}nomenclador/salud/${id}`
  const response = await axios.get(url, requestData())
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
57 58
  const hAreas = response.data
  store.commit('setHealthAreas', hAreas)
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
59 60
  return response
}