Refactor API endpoints to use cached data and update Code of Conduct to Contributor Covenant

This commit is contained in:
yuanhau 2025-05-14 18:52:14 +08:00
parent 878ac4f1a6
commit 96b297f617
17 changed files with 207 additions and 31 deletions

View file

@ -17,7 +17,7 @@ const {
data: fetchNewsOrgInfo,
pending,
error,
} = useFetch("/api/getData/fetchNewsOrgInfo", {
} = useFetch("/api/cached/getData/fetchNewsOrgInfo", {
method: "POST",
headers: {
"Content-Type": "application/json",

View file

@ -37,23 +37,27 @@ onMounted(() => {
</div>
<hr />
</div>
<div
ref="chatContainerRef"
class="flex-1 overflow-y-auto p-4 space-y-4"
>
<div
v-for="message in messages"
class="max-w-[80%] rounded-lg p-3"
>
<div ref="chatContainerRef" class="flex-1 overflow-y-auto p-4 space-y-4">
<div
v-for="message in messages"
class="max-w-[80%] rounded-lg p-3"
></div>
</div>
</div>
<div class="text-black w-full flex flex-row space-x-2">
<Input class="flex-1 rounded-xl" placeholder="Type a message..." v-ref="message" />
<Input
class="flex-1 rounded-xl"
placeholder="Type a message..."
v-ref="message"
/>
<button
class="pl-2 pr-2 mr-1 ml-1 bg-black text-white rounded-full hover:bg-gray-700 hover:translate-y-[-4px] transition-all duration-300 disabled:cursor-not-allowed disabled:hover:translate-y-0 disabled:bg-color-500"
:disabled="() => {if (!message) return false; else return true;}"
:disabled="
() => {
if (!message) return false;
else return true;
}
"
>
<Send class="w-5 h-5" />
</button>

View file

@ -6,7 +6,7 @@ import Button from "~/components/ui/button/Button.vue";
const pending = ref();
try {
const { data, pending } = await useFetch("/api/rss/google");
const { data, pending } = await useFetch("/api/cached/rss/google");
ffeed.value = data.value;
} catch (error) {
console.error("Error:", error);

View file

@ -13,7 +13,7 @@ const {
data: source,
pending,
error,
} = await useFetch("/api/getData/fetchSources", {
} = await useFetch("/api/cached/getData/fetchSources", {
method: "POST",
headers: {
"Content-Type": "application/json",

View file

@ -1 +1,8 @@
<template></template>
<script setup lang="ts">
import { Input } from "~/components/ui/input";
</script>
<template>
<div>
<Input />
</div>
</template>