added first pass of homepage
This commit is contained in:
@@ -64,6 +64,7 @@ import { authRouter } from './routes/auth';
|
|||||||
import { roles, memberRoles } from './routes/roles';
|
import { roles, memberRoles } from './routes/roles';
|
||||||
import { courseRouter, eventRouter } from './routes/course';
|
import { courseRouter, eventRouter } from './routes/course';
|
||||||
import { calendarRouter } from './routes/calendar';
|
import { calendarRouter } from './routes/calendar';
|
||||||
|
import { docsRouter } from './routes/docs';
|
||||||
|
|
||||||
app.use('/application', applicationRouter);
|
app.use('/application', applicationRouter);
|
||||||
app.use('/ranks', ranks);
|
app.use('/ranks', ranks);
|
||||||
@@ -77,6 +78,7 @@ app.use('/memberRoles', memberRoles)
|
|||||||
app.use('/course', courseRouter)
|
app.use('/course', courseRouter)
|
||||||
app.use('/courseEvent', eventRouter)
|
app.use('/courseEvent', eventRouter)
|
||||||
app.use('/calendar', calendarRouter)
|
app.use('/calendar', calendarRouter)
|
||||||
|
app.use('/docs', docsRouter)
|
||||||
app.use('/', authRouter)
|
app.use('/', authRouter)
|
||||||
|
|
||||||
app.get('/ping', (req, res) => {
|
app.get('/ping', (req, res) => {
|
||||||
|
|||||||
24
api/src/routes/docs.ts
Normal file
24
api/src/routes/docs.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
import { Request, Response } from 'express';
|
||||||
|
import { requireLogin } from '../middleware/auth';
|
||||||
|
|
||||||
|
router.get('/welcome', [requireLogin], async (req: Request, res: Response) => {
|
||||||
|
const output = await fetch(`${process.env.DOC_HOST}/api/pages/717`, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Token ${process.env.DOC_TOKEN_ID}:${process.env.DOC_TOKEN_SECRET}`,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (output.ok) {
|
||||||
|
const out = await output.json();
|
||||||
|
res.status(200).json(out.html);
|
||||||
|
} else {
|
||||||
|
console.error("Failed to fetch LOA policy from bookstack");
|
||||||
|
res.sendStatus(500);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
export const docsRouter = router;
|
||||||
18
ui/src/api/docs.ts
Normal file
18
ui/src/api/docs.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
// @ts-ignore
|
||||||
|
const addr = import.meta.env.VITE_APIHOST;
|
||||||
|
|
||||||
|
export async function getWelcomeMessage(): Promise<string> {
|
||||||
|
const res = await fetch(`${addr}/docs/welcome`, {
|
||||||
|
method: "GET",
|
||||||
|
credentials: 'include',
|
||||||
|
});
|
||||||
|
if (res.ok) {
|
||||||
|
const out = res.json();
|
||||||
|
if (!out) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { getWelcomeMessage } from '@/api/docs';
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -10,6 +12,13 @@ const user = useUserStore();
|
|||||||
function goToApplication() {
|
function goToApplication() {
|
||||||
router.push('/join') // change to your form route
|
router.push('/join') // change to your form route
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
let policy = await getWelcomeMessage() as any;
|
||||||
|
welcomeRef.value.innerHTML = policy;
|
||||||
|
})
|
||||||
|
|
||||||
|
const welcomeRef = ref<HTMLElement>(null);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -23,8 +32,10 @@ function goToApplication() {
|
|||||||
Begin Application
|
Begin Application
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else class="mt-10">
|
||||||
HOMEPAGEEEEEEEEEEEEEEEEEEE
|
<div ref="welcomeRef" class="bookstack-container">
|
||||||
|
<!-- LOA policy gets loaded here -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user