placeholdered bookstack integration

This commit is contained in:
2025-12-11 11:38:11 -05:00
parent 8cdbb99d6f
commit dcb4720129
3 changed files with 25 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
# SITE SETTINGS
VITE_APIHOST=
VITE_DOCHOST= # https://bookstack.whatever.com/api
VITE_ENVIRONMENT= # dev / prod
# Glitchtip

View File

@@ -87,4 +87,22 @@ export async function getLoaTypes(): Promise<LOAType[]> {
} else {
return null;
}
};
export async function getLoaPolicy(): Promise<string> {
//@ts-ignore
const res = await fetch(`${import.meta.env.VITE_DOCHOST}/api/pages/42`, {
method: "GET",
credentials: 'include',
});
if (res.ok) {
const out = res.json();
console.log(out);
if (!out) {
return null;
}
return out;
} else {
return null;
}
}

View File

@@ -17,11 +17,10 @@ import type { Ref } from "vue"
import Popover from "@/components/ui/popover/Popover.vue";
import PopoverTrigger from "@/components/ui/popover/PopoverTrigger.vue";
import PopoverContent from "@/components/ui/popover/PopoverContent.vue";
import { RangeCalendar } from "@/components/ui/range-calendar"
import { cn } from "@/lib/utils";
import { CalendarIcon } from "lucide-vue-next"
import Textarea from "@/components/ui/textarea/Textarea.vue";
import { getLoaTypes, submitLOA } from "@/api/loa"; // <-- import the submit function
import { getLoaPolicy, getLoaTypes, submitLOA } from "@/api/loa"; // <-- import the submit function
import { LOARequest, LOAType } from "@shared/types/loa";
import { useForm, Field as VeeField } from "vee-validate";
import {
@@ -41,6 +40,7 @@ import FieldError from "../ui/field/FieldError.vue";
const members = ref<Member[]>([])
const loaTypes = ref<LOAType[]>();
const policyString = ref<string | null>(null);
const currentMember = ref<Member | null>(null);
@@ -63,7 +63,6 @@ const df = new Intl.DateTimeFormat('en-US', {
import { loaSchema } from '@shared/schemas/loaSchema'
import { toTypedSchema } from "@vee-validate/zod";
import Calendar from "../ui/calendar/Calendar.vue";
import { el } from "@fullcalendar/core/internal-common";
const { handleSubmit, values, resetForm } = useForm({
validationSchema: toTypedSchema(loaSchema),
@@ -81,11 +80,15 @@ onMounted(async () => {
if (props.member) {
currentMember.value = props.member;
}
if (!props.adminMode) {
policyString.value = await getLoaPolicy();
}
members.value = await getMembers();
loaTypes.value = await getLoaTypes();
console.log(currentMember.value);
resetForm({ values: { member_id: currentMember.value?.member_id } });
});
const defaultPlaceholder = today(getLocalTimeZone())
const minEndDate = computed(() => {