From 039534b6f9e15b3ff4fb5800bfd5609e1db0d72b Mon Sep 17 00:00:00 2001 From: ajdj100 Date: Sun, 17 Aug 2025 20:27:51 -0400 Subject: [PATCH] Added support for application statuses --- api/index.js | 11 +++++------ ui/src/api/application.ts | 13 ++++++++++++- ui/src/pages/Application.vue | 16 +++++++++++++++- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/api/index.js b/api/index.js index 42fd907..c1d2e07 100644 --- a/api/index.js +++ b/api/index.js @@ -7,16 +7,14 @@ app.use(express.json()) const port = 3000 -app.get('/', (req, res) => { - res.send('Hello World!') -}) - var application; var applicationMessages = []; +var applicationStatus; app.post('/application', (req, res) => { data = req.body - application = data; + application = data.App; + applicationStatus = data.Status; console.log(data); res.send('Application received') }); @@ -25,7 +23,8 @@ app.get('/application/me', (req, res) => { if (application) { let data = { "app": application, - "messages": applicationMessages + "messages": applicationMessages, + "Status": applicationStatus, } res.send(data); } diff --git a/ui/src/api/application.ts b/ui/src/api/application.ts index 707c05f..df2f2ae 100644 --- a/ui/src/api/application.ts +++ b/ui/src/api/application.ts @@ -20,6 +20,12 @@ type ApplicationFull = Partial<{ messages: object[] }> +export enum Status { + Pending = "Pending", + Approved = "Approved", + Denied = "Denied", +} + const addr = "localhost:3000" export async function loadApplication(): Promise { @@ -32,10 +38,15 @@ export async function loadApplication(): Promise { } export async function postApplication(val: any) { + + let out = { + "App": val, + "Status": Status.Pending + } await fetch(`http://${addr}/application`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(val), + body: JSON.stringify(out), }) } diff --git a/ui/src/pages/Application.vue b/ui/src/pages/Application.vue index 660876a..69b93f4 100644 --- a/ui/src/pages/Application.vue +++ b/ui/src/pages/Application.vue @@ -2,12 +2,13 @@ import ApplicationChat from '@/components/application/ApplicationChat.vue'; import ApplicationForm from '@/components/application/ApplicationForm.vue'; import { onMounted, ref } from 'vue'; -import { loadApplication, postApplication, postChatMessage } from '@/api/application'; +import { loadApplication, postApplication, postChatMessage, Status } from '@/api/application'; const appData = ref | null>(null); const chatData = ref([]) const readOnly = ref(false); const newApp = ref(true); +const status = ref(Status.Pending); onMounted(async () => { try { @@ -29,6 +30,19 @@ onMounted(async () => {