Small fixes
This commit is contained in:
@@ -24,7 +24,8 @@ export default defineConfig(
|
|||||||
rules: {
|
rules: {
|
||||||
// typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
|
// typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
|
||||||
// see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
|
// see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
|
||||||
'no-undef': 'off'
|
'no-undef': 'off',
|
||||||
|
'svelte/no-navigation-without-resolve': 'off'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { writable } from 'svelte/store';
|
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { API_URL } from '$lib/api';
|
import { API_URL } from '$lib/api';
|
||||||
|
|
||||||
|
|||||||
@@ -76,21 +76,21 @@
|
|||||||
async function loadMoreNotifications() {
|
async function loadMoreNotifications() {
|
||||||
loadingMore = true;
|
loadingMore = true;
|
||||||
try {
|
try {
|
||||||
const more = await fetchSubscriptionNotifications(subscription.id.toString(), limit, offset);
|
const more = await fetchSubscriptionNotifications(subscription!.id.toString(), limit, offset);
|
||||||
notifications = [...notifications, ...more];
|
notifications = [...notifications, ...more];
|
||||||
offset += more.length;
|
offset += more.length;
|
||||||
if (more.length < limit) {
|
if (more.length < limit) {
|
||||||
allLoaded = true;
|
allLoaded = true;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (err) {
|
||||||
window.showNotification('error', 'Failed to load more notifications');
|
window.showNotification('error', 'Failed to load more notifications - ' + err);
|
||||||
}
|
}
|
||||||
loadingMore = false;
|
loadingMore = false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main class="p-4">
|
<main class="p-4">
|
||||||
<h1 class="text-2xl font-bold mb-4">Notifications for {subscription.topic}:</h1>
|
<h1 class="text-2xl font-bold mb-4">Notifications for {subscription!.topic}:</h1>
|
||||||
|
|
||||||
<div class="flex justify-between items-center mb-4">
|
<div class="flex justify-between items-center mb-4">
|
||||||
<a href="/notifications" class="text-blue-500 hover:underline">← Return to Subscriptions</a>
|
<a href="/notifications" class="text-blue-500 hover:underline">← Return to Subscriptions</a>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
localStorage.setItem('token', data.access_token);
|
localStorage.setItem('token', data.access_token);
|
||||||
goto('/');
|
goto('/');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error = 'Network error';
|
error = 'Network error - ' + err;
|
||||||
} finally {
|
} finally {
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
export let params: { id: string };
|
export let params: { id: string };
|
||||||
let script: Script = null;
|
let script: Script | null = null;
|
||||||
let logs: Log[] = [];
|
let logs: Log[] = [];
|
||||||
let updatedTitle: string = '';
|
let updatedTitle: string = '';
|
||||||
let updatedContent: string = '';
|
let updatedContent: string = '';
|
||||||
@@ -57,10 +57,10 @@
|
|||||||
|
|
||||||
async function handleExecuteScript() {
|
async function handleExecuteScript() {
|
||||||
try {
|
try {
|
||||||
await executeScript(script.id);
|
await executeScript(script!.id);
|
||||||
window.showNotification('success', 'Script executed successfully!');
|
window.showNotification('success', 'Script executed successfully!');
|
||||||
// Reload the list of logs after execution
|
// Reload the list of logs after execution
|
||||||
logs = (await fetchLogs(script.id)).sort(
|
logs = (await fetchLogs(script!.id)).sort(
|
||||||
(a, b) => new Date(b.created_at!).getTime() - new Date(a.created_at!).getTime()
|
(a, b) => new Date(b.created_at!).getTime() - new Date(a.created_at!).getTime()
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
|
|
||||||
async function handleDeleteLog(logId: number) {
|
async function handleDeleteLog(logId: number) {
|
||||||
try {
|
try {
|
||||||
await deleteLog(script.id, logId);
|
await deleteLog(script!.id, logId);
|
||||||
logs = logs.filter((log) => log.id !== logId);
|
logs = logs.filter((log) => log.id !== logId);
|
||||||
window.showNotification('success', 'Log deleted successfully!');
|
window.showNotification('success', 'Log deleted successfully!');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import type { Settings } from '$lib/api';
|
import type { Settings } from '$lib/api';
|
||||||
import CodeMirror from 'svelte-codemirror-editor';
|
import CodeMirror from 'svelte-codemirror-editor';
|
||||||
|
|
||||||
let settings: Settings = $state(null);
|
let settings: Settings | null = $state(null);
|
||||||
let isLoading = $state(false);
|
let isLoading = $state(false);
|
||||||
let error: string | null = $state(null);
|
let error: string | null = $state(null);
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
class="mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600"
|
class="mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600"
|
||||||
onclick={() => saveSetting(settings)}
|
onclick={() => saveSetting(settings!)}
|
||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user