set up viewing of users application history
Some checks failed
Continuous Deployment / Update Deployment (push) Failing after 1m22s

This commit is contained in:
2025-12-08 21:28:02 -05:00
parent 4a65596283
commit 63267ac679
7 changed files with 296 additions and 81 deletions

View File

@@ -122,6 +122,26 @@ export async function getAllApplications(): Promise<ApplicationFull> {
}
}
export async function loadMyApplications(): Promise<ApplicationFull> {
const res = await fetch(`${addr}/application/meList`, { credentials: 'include' })
if (res.ok) {
return res.json()
} else {
console.error("Something went wrong approving the application")
}
}
export async function getMyApplication(id: number): Promise<ApplicationFull> {
const res = await fetch(`${addr}/application/me/${id}`, { credentials: 'include' })
if (res.status === 204) return null
if (res.status === 403) throw new Error("Unauthorized");
if (!res.ok) throw new Error('Failed to load application')
const json = await res.json()
// Accept either the object at root or under `application`
return json;
}
export async function approveApplication(id: Number) {
const res = await fetch(`${addr}/application/approve/${id}`, { method: 'POST' })