Small fixes

This commit is contained in:
Sami Abuzakuk
2025-11-01 16:15:35 +01:00
parent 8eef535e02
commit c957d839dd
6 changed files with 13 additions and 13 deletions

View File

@@ -24,7 +24,8 @@ export default defineConfig(
rules: {
// 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
'no-undef': 'off'
'no-undef': 'off',
'svelte/no-navigation-without-resolve': 'off'
}
},
{

View File

@@ -1,5 +1,4 @@
<script lang="ts">
import { writable } from 'svelte/store';
import { goto } from '$app/navigation';
import { API_URL } from '$lib/api';

View File

@@ -76,21 +76,21 @@
async function loadMoreNotifications() {
loadingMore = true;
try {
const more = await fetchSubscriptionNotifications(subscription.id.toString(), limit, offset);
const more = await fetchSubscriptionNotifications(subscription!.id.toString(), limit, offset);
notifications = [...notifications, ...more];
offset += more.length;
if (more.length < limit) {
allLoaded = true;
}
} catch (error) {
window.showNotification('error', 'Failed to load more notifications');
} catch (err) {
window.showNotification('error', 'Failed to load more notifications - ' + err);
}
loadingMore = false;
}
</script>
<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">
<a href="/notifications" class="text-blue-500 hover:underline">← Return to Subscriptions</a>

View File

@@ -29,7 +29,7 @@
localStorage.setItem('token', data.access_token);
goto('/');
} catch (err) {
error = 'Network error';
error = 'Network error - ' + err;
} finally {
loading = false;
}

View File

@@ -13,7 +13,7 @@
import { onMount } from 'svelte';
export let params: { id: string };
let script: Script = null;
let script: Script | null = null;
let logs: Log[] = [];
let updatedTitle: string = '';
let updatedContent: string = '';
@@ -57,10 +57,10 @@
async function handleExecuteScript() {
try {
await executeScript(script.id);
await executeScript(script!.id);
window.showNotification('success', 'Script executed successfully!');
// 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()
);
} catch (err) {
@@ -87,7 +87,7 @@
async function handleDeleteLog(logId: number) {
try {
await deleteLog(script.id, logId);
await deleteLog(script!.id, logId);
logs = logs.filter((log) => log.id !== logId);
window.showNotification('success', 'Log deleted successfully!');
} catch (err) {

View File

@@ -4,7 +4,7 @@
import type { Settings } from '$lib/api';
import CodeMirror from 'svelte-codemirror-editor';
let settings: Settings = $state(null);
let settings: Settings | null = $state(null);
let isLoading = $state(false);
let error: string | null = $state(null);
@@ -74,7 +74,7 @@
<button
class="mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600"
onclick={() => saveSetting(settings)}
onclick={() => saveSetting(settings!)}
>
Save
</button>