Add banner endpoint
This commit is contained in:
parent
b192bf06e1
commit
524670b7c9
8 changed files with 97 additions and 0 deletions
|
|
@ -0,0 +1,46 @@
|
|||
<script setup lang="ts">
|
||||
import { useApiRequest } from "@/apiRequest";
|
||||
import { ref, useTemplateRef } from "vue";
|
||||
import CError from "./CError.vue";
|
||||
|
||||
const { disabled, error, makeRequest } = useApiRequest();
|
||||
const form = useTemplateRef<HTMLFormElement>("form");
|
||||
|
||||
const text = ref("");
|
||||
const feed = ref(true);
|
||||
|
||||
function submit() {
|
||||
const data = new URLSearchParams();
|
||||
data.append("text", text.value);
|
||||
data.append("feed", String(feed.value));
|
||||
void makeRequest("api/banner", data);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<form ref="form" @submit.prevent="submit">
|
||||
<h2>Banner</h2>
|
||||
|
||||
<input v-model="text" :disabled />
|
||||
|
||||
<div class="wide">
|
||||
<label><input v-model="feed" type="checkbox" :disabled /> Feed</label>
|
||||
</div>
|
||||
|
||||
<button :disabled>Print</button>
|
||||
<CError :message="error" />
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.wide {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import CDocumentBanner from "./CDocumentBanner.vue";
|
||||
import CDocumentCalendar from "./CDocumentCalendar.vue";
|
||||
import CDocumentCells from "./CDocumentCells.vue";
|
||||
import CDocumentChat from "./CDocumentChat.vue";
|
||||
|
|
@ -11,6 +12,7 @@ import CDocumentTictactoe from "./CDocumentTictactoe.vue";
|
|||
import CDocumentXkcd from "./CDocumentXkcd.vue";
|
||||
|
||||
const mode = ref<
|
||||
| "banner"
|
||||
| "calendar"
|
||||
| "cells"
|
||||
| "chat"
|
||||
|
|
@ -26,6 +28,7 @@ const mode = ref<
|
|||
<template>
|
||||
<div class="outer">
|
||||
<button v-if="mode" class="close" @click="mode = undefined">X</button>
|
||||
<CDocumentBanner v-if="mode === 'banner'" />
|
||||
<CDocumentCalendar v-if="mode === 'calendar'" />
|
||||
<CDocumentCells v-if="mode === 'cells'" />
|
||||
<CDocumentChat v-if="mode === 'chat'" />
|
||||
|
|
@ -39,6 +42,7 @@ const mode = ref<
|
|||
<section>
|
||||
<p>What do you want to print?</p>
|
||||
<div class="list">
|
||||
<button @click="mode = 'banner'">Banner</button>
|
||||
<button @click="mode = 'calendar'">Calendar</button>
|
||||
<button @click="mode = 'cells'">Cellular Automaton</button>
|
||||
<button @click="mode = 'chat'">Chat Message</button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue