What is this? undefined:undefined? A recipe for debugging hell. (I used
Some checks are pending
Build and Push Beta Image / build-and-push (push) Waiting to run

GitHub Copilot for this debugging session.), Also changes some broken
stuff like const res = req.json() req.status === "success", what even is
that 🙃
This commit is contained in:
yuanhau 2025-06-23 01:10:24 +08:00
parent 87d5620e34
commit bf4e695676

View file

@ -108,17 +108,18 @@ const aiSummary = async () => {
}; };
const starArticle = async () => { const starArticle = async () => {
const req = await fetch(`/user/${slug}/fav`); const buildUrl = `/user/${slug}/fav`;
const req = await fetch(buildUrl);
const res = await req.json(); const res = await req.json();
if (req.status === success) { if (res.status === "success") {
staredStatus.value = req.starred; staredStatus.value = res.starred;
} }
}; };
onMounted(async () => { onMounted(async () => {
const req = await fetch(`/user/${slug}/star`); const req = await fetch(`/user/${slug}/star`);
const res = await req.json(); const res = await req.json();
staredStatus.value = req; staredStatus.value = res;
}); });
</script> </script>
<template> <template>
@ -188,19 +189,22 @@ onMounted(async () => {
<div v-else>{{ summaryText }}</div> <div v-else>{{ summaryText }}</div>
</div> </div>
</div> </div>
<div class="flex flex-col bg-gray-500"> <!--<div class="flex flex-col bg-gray-500">
<!--Similar articles--> <!--Similar articles-->
<div class="flex flex-row" v-for="item in likeart"> <!--<div class="flex flex-row" v-for="item in likeart">
<img /><!--Image--> <img /><!--Image-->
<div class="flex flex-col"> <!--<div class="flex flex-col">
<h2>title</h2> <h2>title</h2>
<span>description</span> <span>description</span>
</div> </div>
</div> </div>
</div> </div>-->
<button <button
@click="starArticle" @click="starArticle"
:class="'duration-300 transition-all' + {staredStatus && 'fill-blue-500 text-blue-500'" :class="[
'duration-300 transition-all',
{ 'fill-blue-500 text-blue-500': staredStatus },
]"
> >
<StarIcon /> <StarIcon />
</button> </button>