wrapped up most of the application stuff for now (pending database integration)
This commit is contained in:
39
ui/src/pages/Application.vue
Normal file
39
ui/src/pages/Application.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<script setup lang="ts">
|
||||
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';
|
||||
|
||||
const appData = ref<Record<string, unknown> | null>(null);
|
||||
const chatData = ref<object[]>([])
|
||||
const readOnly = ref<boolean>(false);
|
||||
const newApp = ref<boolean>(true);
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const data = await loadApplication()
|
||||
if (data) {
|
||||
appData.value = data.app;
|
||||
chatData.value = data.messages;
|
||||
readOnly.value = true;
|
||||
} else {
|
||||
appData.value = {}
|
||||
newApp.value = false;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="max-w-3xl mx-auto my-20">
|
||||
<ApplicationForm v-if="appData" :read-only="readOnly" :data="appData" @submit="(e) => { postApplication(e) }"
|
||||
class="mb-7"></ApplicationForm>
|
||||
<div v-if="newApp">
|
||||
<h3 class="scroll-m-20 text-2xl font-semibold tracking-tight mb-4">Discussion</h3>
|
||||
<ApplicationChat :messages="chatData" @post="postChatMessage"></ApplicationChat>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user