hooked up recruiter application management page
This commit is contained in:
@@ -68,6 +68,7 @@ app.get('/application/:id', async (req, res) => {
|
||||
let appID = req.params.id;
|
||||
|
||||
//TODO: Replace with real user Authorization and whatnot
|
||||
// if the application is not "me" and I am not a recruiter, deny access to the application (return 403 or whatever)
|
||||
if (appID === "me")
|
||||
appID = 2;
|
||||
|
||||
|
||||
@@ -69,11 +69,11 @@ export enum Status {
|
||||
Accepted = "Accepted",
|
||||
Denied = "Denied",
|
||||
}
|
||||
|
||||
|
||||
const addr = "localhost:3000"
|
||||
|
||||
export async function loadApplication(): Promise<ApplicationFull | null> {
|
||||
const res = await fetch(`http://${addr}/application/me`)
|
||||
export async function loadApplication(id: number | string): Promise<ApplicationFull | null> {
|
||||
const res = await fetch(`http://${addr}/application/${id}`)
|
||||
if (res.status === 204) return null
|
||||
if (!res.ok) throw new Error('Failed to load application')
|
||||
const json = await res.json()
|
||||
|
||||
@@ -3,6 +3,7 @@ import ApplicationChat from '@/components/application/ApplicationChat.vue';
|
||||
import ApplicationForm from '@/components/application/ApplicationForm.vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { ApplicationData, loadApplication, postApplication, postChatMessage, Status } from '@/api/application';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
const appData = ref<ApplicationData>(null);
|
||||
const appID = ref<number | null>(null);
|
||||
@@ -16,7 +17,10 @@ const loading = ref<boolean>(true);
|
||||
const member_name = ref<string>();
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const raw = await loadApplication()
|
||||
//get app ID from URL param
|
||||
const router = useRoute();
|
||||
const appIDRaw = router.params.id.toString();
|
||||
const raw = await loadApplication(appIDRaw);
|
||||
if (raw === null) {
|
||||
//new app
|
||||
appData.value = null
|
||||
|
||||
@@ -58,8 +58,9 @@ async function handleDeny(id) {
|
||||
appList.value = await getAllApplications();
|
||||
}
|
||||
|
||||
const router = useRouter();
|
||||
function openApplication(id) {
|
||||
useRouter().push('/hi')
|
||||
router.push(`/applications/${id}`)
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import ManageApplications from '@/pages/ManageApplications.vue'
|
||||
import Application from '@/pages/Application.vue'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
],
|
||||
{ path: '/applications', component: ManageApplications },
|
||||
{ path: '/applications/:id', component: Application },
|
||||
]
|
||||
|
||||
})
|
||||
|
||||
export default router
|
||||
|
||||
Reference in New Issue
Block a user