mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
fix(frontend:user): resolve lint errors
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import { goto } from '$app/navigation';
|
import { goto, afterNavigate } from '$app/navigation';
|
||||||
import { page } from '$app/state';
|
import { page } from '$app/state';
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import type { Pagination } from '$lib/types/pagination';
|
import type { Pagination } from '$lib/types/pagination';
|
||||||
@@ -80,7 +80,14 @@
|
|||||||
const url = new URL(page.url);
|
const url = new URL(page.url);
|
||||||
url.searchParams.set('tab', newPageTab);
|
url.searchParams.set('tab', newPageTab);
|
||||||
|
|
||||||
await goto(url, { replaceState: true, noScroll: true, keepFocus: true, invalidateAll: false });
|
// @ts-expect-error
|
||||||
|
// eslint-disable-next-line svelte/no-navigation-without-resolve
|
||||||
|
await goto(resolve(url.pathname) + url.search, {
|
||||||
|
replaceState: true,
|
||||||
|
noScroll: true,
|
||||||
|
keepFocus: true,
|
||||||
|
invalidateAll: false
|
||||||
|
});
|
||||||
|
|
||||||
if (newPageTab === 'settings' && isOwner && apiKeys.length === 0) {
|
if (newPageTab === 'settings' && isOwner && apiKeys.length === 0) {
|
||||||
await fetchApiKeys();
|
await fetchApiKeys();
|
||||||
@@ -104,13 +111,11 @@
|
|||||||
case 'settings':
|
case 'settings':
|
||||||
if (isOwner || $user?.roles?.some((r) => r === 255 || r === 1)) {
|
if (isOwner || $user?.roles?.some((r) => r === 255 || r === 1)) {
|
||||||
activeTab = 'settings';
|
activeTab = 'settings';
|
||||||
if (isOwner && apiKeys.length === 0) fetchApiKeys();
|
|
||||||
} else activeTab = 'pastes';
|
} else activeTab = 'pastes';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (isOwner) {
|
if (isOwner) {
|
||||||
activeTab = 'settings';
|
activeTab = 'settings';
|
||||||
if (apiKeys.length === 0) fetchApiKeys();
|
|
||||||
} else {
|
} else {
|
||||||
activeTab = 'pastes';
|
activeTab = 'pastes';
|
||||||
}
|
}
|
||||||
@@ -399,7 +404,7 @@
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
const tab = page.url.searchParams.get('tab');
|
const tab = page.url.searchParams.get('tab');
|
||||||
if (tab === 'settings' && isOwner) {
|
if ((tab === 'settings' || !tab) && isOwner) {
|
||||||
fetchApiKeys();
|
fetchApiKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,6 +413,13 @@
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterNavigate(() => {
|
||||||
|
const tab = page.url.searchParams.get('tab');
|
||||||
|
if ((tab === 'settings' || !tab) && isOwner && apiKeys.length === 0) {
|
||||||
|
fetchApiKeys();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$: reportSiteKey =
|
$: reportSiteKey =
|
||||||
(data as unknown as { authOptions?: { cf_turnstile_site_key?: string | null } }).authOptions
|
(data as unknown as { authOptions?: { cf_turnstile_site_key?: string | null } }).authOptions
|
||||||
?.cf_turnstile_site_key ?? null;
|
?.cf_turnstile_site_key ?? null;
|
||||||
|
|||||||
Reference in New Issue
Block a user