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