diff --git a/api/src/routes/applications.ts b/api/src/routes/applications.ts index 8b2f61d..76c0eca 100644 --- a/api/src/routes/applications.ts +++ b/api/src/routes/applications.ts @@ -38,12 +38,27 @@ router.get('/all', async (req, res) => { }); router.get('/me', async (req, res) => { + let userID = req.user.id; - console.log("application/me") + try { + let application = await getMemberApplication(userID); - let app = getMemberApplication(userID); - console.log(app); + if (application === undefined) + res.sendStatus(204); + + const comments: CommentRow[] = await getApplicationComments(application.id); + + const output: ApplicationFull = { + application, + comments, + } + + return res.status(200).json(output); + } catch (error) { + console.error('Failed to load application:', error); + return res.status(500).json(error); + } }) // GET /application/:id @@ -54,7 +69,7 @@ router.get('/:id', async (req, res) => { const application = await getApplicationByID(appID); if (application === undefined) return res.sendStatus(204); - + const comments: CommentRow[] = await getApplicationComments(appID); const output: ApplicationFull = { diff --git a/ui/src/api/application.ts b/ui/src/api/application.ts index 7ef6086..85a3dc5 100644 --- a/ui/src/api/application.ts +++ b/ui/src/api/application.ts @@ -74,7 +74,7 @@ export enum ApplicationStatus { const addr = import.meta.env.VITE_APIHOST; export async function loadApplication(id: number | string): Promise { - const res = await fetch(`${addr}/application/${id}`) + const res = await fetch(`${addr}/application/${id}`, { credentials: 'include' }) if (res.status === 204) return null if (!res.ok) throw new Error('Failed to load application') const json = await res.json() diff --git a/ui/src/components/Navigation/Navbar.vue b/ui/src/components/Navigation/Navbar.vue index 58335d4..72c5bd4 100644 --- a/ui/src/components/Navigation/Navbar.vue +++ b/ui/src/components/Navigation/Navbar.vue @@ -167,8 +167,9 @@ function blurAfter() {

{{ userStore.user.name }}

- My Profile - Settings + + + My Application Logout diff --git a/ui/src/components/application/ApplicationChat.vue b/ui/src/components/application/ApplicationChat.vue index a4d48a1..cc1d653 100644 --- a/ui/src/components/application/ApplicationChat.vue +++ b/ui/src/components/application/ApplicationChat.vue @@ -38,7 +38,7 @@ function onSubmit(values: { text: string }, { resetForm }: { resetForm: () => vo
- Comment + Comment