This commit is contained in:
xfarrow
2024-03-18 17:54:57 +01:00
parent 072d659425
commit 86bb9717d8
4 changed files with 51 additions and 9 deletions

View File

@ -38,14 +38,14 @@
alert("Invalid URL.");
return;
}
const response = await fetch(`${API_URL}/organization/${idToDisplay}`, {
const response = await fetch(`${API_URL}/organizations/${idToDisplay}`, {
headers: {
"Content-type": "application/json; charset=UTF-8",
}
});
const data = await response.json();
if (response.ok) {
populateFields(data.name, data.location, data.description, data.is_hiring);
populateFields(data.name, data.location, data.description, isOrganizationHiring(idToDisplay));
document.body.style.display = "block"; // Show page
} else {
alert(data.error);
@ -67,6 +67,16 @@
}
}
async function isOrganizationHiring(organizationId) {
const response = await fetch(`${API_URL}/organizations/${organizationId}/joboffers`, {
headers: {
"Content-type": "application/json; charset=UTF-8",
}
});
const data = await response.json();
return data.length > 0;
}
</script>
</body>