mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 15:51:01 +08:00
Compare commits
No commits in common. "200e89f066668513b27084559ea2e8ef9505d159" and "846c27293da68a9caa14703ffcb5825617b2438b" have entirely different histories.
200e89f066
...
846c27293d
@ -31,7 +31,6 @@ const isGenerating = ref(false);
|
||||
const summaryText = ref("");
|
||||
const { locale } = useI18n();
|
||||
const likeart = ref([]);
|
||||
const staredStatus = ref(false);
|
||||
// Translating logic
|
||||
const translateText = ref(false);
|
||||
const translatedBefore = ref(false);
|
||||
@ -106,21 +105,6 @@ const aiSummary = async () => {
|
||||
isGenerating.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const starArticle = async () => {
|
||||
const buildUrl = `/user/${slug}/fav`;
|
||||
const req = await fetch(buildUrl);
|
||||
const res = await req.json();
|
||||
if (res.status === "success") {
|
||||
staredStatus.value = res.starred;
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
const req = await fetch(`/user/${slug}/star`);
|
||||
const res = await req.json();
|
||||
staredStatus.value = res;
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
@ -189,25 +173,17 @@ onMounted(async () => {
|
||||
<div v-else>{{ summaryText }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="flex flex-col bg-gray-500">
|
||||
<div class="flex flex-col bg-gray-500">
|
||||
<!--Similar articles-->
|
||||
<!--<div class="flex flex-row" v-for="item in likeart">
|
||||
<div class="flex flex-row" v-for="item in likeart">
|
||||
<img /><!--Image-->
|
||||
<!--<div class="flex flex-col">
|
||||
<div class="flex flex-col">
|
||||
<h2>title</h2>
|
||||
<span>description</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
<button
|
||||
@click="starArticle"
|
||||
:class="[
|
||||
'duration-300 transition-all',
|
||||
{ 'fill-blue-500 text-blue-500': staredStatus },
|
||||
]"
|
||||
>
|
||||
<StarIcon />
|
||||
</button>
|
||||
</div>
|
||||
<button><StarIcon /></button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -11,8 +11,8 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const openNewWindow = (itemId: string) => {
|
||||
emit("loadValue", itemId);
|
||||
emit("windowopener", "aboutNewsOrg");
|
||||
emit("loadValue", itemId);
|
||||
};
|
||||
|
||||
const {
|
||||
@ -78,9 +78,9 @@ onMounted(async () => {
|
||||
{{ errorMsg }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row flex-wrap justify-center gap-2">
|
||||
<div class="flex flex-row flexw-wrap justify-center gap-2">
|
||||
<div
|
||||
class="flex flex-col group bg-gray-900/30 rounded-xl p-3 transition-all shadow-lg hover:translate-y-[-2px] ransition-all duration-500 max-w-1/2"
|
||||
class="flex flex-col group bg-gray-900/30 rounded-xl p-3 transition-all duration-500 shadow-lg hover:translate-y-[-2px] ransition-all duration-700"
|
||||
v-for="item in source?.data"
|
||||
:key="item.id"
|
||||
>
|
||||
|
@ -7,6 +7,16 @@ const error = ref(false);
|
||||
const errorMsg = ref("");
|
||||
const emit = defineEmits(["windowopener", "error", "loadValue"]);
|
||||
|
||||
/**
|
||||
* return {
|
||||
userAccount: fetchViaSQL[0].username,
|
||||
firstName: fetchViaSQL[0].firstName,
|
||||
requested_action: "CONTINUE",
|
||||
current_spot: "KEEP_LOGIN",
|
||||
email: fetchViaSQL[0].email,
|
||||
avatarURL: fetchViaSQL[0].avatarurl,
|
||||
};
|
||||
*/
|
||||
try {
|
||||
// 喔 我沒有加 await :( 難怪有問題
|
||||
const { data, error: sendError } = await useFetch(
|
||||
@ -15,8 +25,8 @@ try {
|
||||
if (sendError.value) {
|
||||
error.value = true;
|
||||
}
|
||||
if (data.value.requested_action === "CONTINUE") {
|
||||
if (data.value.userAccount && data.value.userAccount.length !== 0) {
|
||||
if (data.requested_action === "KEEP_LOGIN") {
|
||||
if (data.userAccount && data.userAccount.length !== 0) {
|
||||
allowed.value = true;
|
||||
} else {
|
||||
allowed.value = false;
|
||||
|
@ -1,18 +1,16 @@
|
||||
import getUserTokenMinusSQLInjection from "~/server/components/getUserToken";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const userToken = await getUserTokenMinusSQLInjection(event);
|
||||
if (userToken.error.length !== 0) {
|
||||
return {
|
||||
error: userToken.error,
|
||||
};
|
||||
}
|
||||
const loginCookie = await getUserTokenMinusSQLInjection(event);
|
||||
try {
|
||||
deleteCookie(event, "token");
|
||||
return {
|
||||
success: true,
|
||||
error: null,
|
||||
};
|
||||
if (false) {
|
||||
deleteCookie(event, "token");
|
||||
return {
|
||||
success: true,
|
||||
error: null,
|
||||
};
|
||||
}
|
||||
return "testing";
|
||||
} catch (e) {
|
||||
return {
|
||||
success: false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user