Skip to content

Instantly share code, notes, and snippets.

@juniorUsca
Created July 4, 2019 21:03
Show Gist options
  • Save juniorUsca/cade0815135f20c03c2158bfd54f3482 to your computer and use it in GitHub Desktop.
Save juniorUsca/cade0815135f20c03c2158bfd54f3482 to your computer and use it in GitHub Desktop.
Fetch evaluaciones
const baseUrl = gcUrlBase.slice(0, -1)
const options = {
// descomentar para POST
// method: 'POST',
// body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
AppRRHH: Cookies.get('AppRRHH'),
},
}
getEvaluacionesPlantillas = async () => {
try {
const response = await fetch(`${baseUrl}/listarPlantillaEvaluacion`, options);
if (!response.ok) throw Error(response.statusText);
const data = await response.json(); if (data.nCodError > 1) throw Error(data.cMsjError);
return data.oContenido;
} catch (error) { console.log(error) }
return []
},
async miFuncion() {
const datos = await getEvaluacionesPlantillas()
console.log(datos)
}
miFuncion()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment