mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 07:41:02 +08:00
Add validate user & optimize code from coderabbit via PR #6
This commit is contained in:
parent
b862f4cdb0
commit
ad0f13a1a2
@ -81,7 +81,11 @@ const updateContent = async (url: string, tabAction: boolean) => {
|
|||||||
const req = await fetch(`/api/home/lt?query=${url.trim()}`);
|
const req = await fetch(`/api/home/lt?query=${url.trim()}`);
|
||||||
const data = await req.json();
|
const data = await req.json();
|
||||||
if (data) {
|
if (data) {
|
||||||
const coolArray = [...data.uuidData, ...data.nuuiddata?.items];
|
// Made by coderabbit: https://github.com/hpware/news-analyze/pull/6#discussion_r2144713017
|
||||||
|
const coolArray = [
|
||||||
|
...(data.uuidData ?? []),
|
||||||
|
...(data.nuuiddata?.items ?? []),
|
||||||
|
];
|
||||||
contentArray.value =
|
contentArray.value =
|
||||||
coolArray.sort(
|
coolArray.sort(
|
||||||
(title1, title2) => title2.publishTimeUnix - title1.publishTimeUnix,
|
(title1, title2) => title2.publishTimeUnix - title1.publishTimeUnix,
|
||||||
|
@ -43,6 +43,11 @@ const validateUserInfo = async () => {
|
|||||||
isLoggedIn.value = true;
|
isLoggedIn.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const intervalTime = 1000 * 60 * 2; // Validate user Info for every ten min while the admin page is opened.
|
||||||
|
setInterval(async () => {
|
||||||
|
await validateUserInfo();
|
||||||
|
}, intervalTime);
|
||||||
|
|
||||||
const emit = defineEmits(["windowopener"]);
|
const emit = defineEmits(["windowopener"]);
|
||||||
|
|
||||||
const logoutAction = async () => {
|
const logoutAction = async () => {
|
||||||
@ -96,6 +101,7 @@ const showDeleteDialog = ref(false);
|
|||||||
const showLogoutDialog = ref(false);
|
const showLogoutDialog = ref(false);
|
||||||
const confirmDelete = async () => {
|
const confirmDelete = async () => {
|
||||||
await deleteAccount();
|
await deleteAccount();
|
||||||
|
await validateUserInfo();
|
||||||
showDeleteDialog.value = false;
|
showDeleteDialog.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -132,7 +132,14 @@ useSeoMeta({
|
|||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
<NuxtLink :to="localePath('/desktop?openapp=onboard')">
|
<NuxtLink
|
||||||
|
:to="
|
||||||
|
localePath({
|
||||||
|
path: '/desktop',
|
||||||
|
query: { openapp: 'onboard' },
|
||||||
|
})
|
||||||
|
"
|
||||||
|
>
|
||||||
<button
|
<button
|
||||||
class="m-4 mr-1 ml-1 bg-[#8C9393] text-white p-3 rounded-[10px] bg-gradient-to-l from-sky-500 to-purple-600 transition-all duration-150 hover:transform hover:scale-105 hover:shadow-lg"
|
class="m-4 mr-1 ml-1 bg-[#8C9393] text-white p-3 rounded-[10px] bg-gradient-to-l from-sky-500 to-purple-600 transition-all duration-150 hover:transform hover:scale-105 hover:shadow-lg"
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user