Small fixes
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { writable } from 'svelte/store';
|
||||
import { goto } from '$app/navigation';
|
||||
import { API_URL } from '$lib/api';
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
localStorage.setItem('token', data.access_token);
|
||||
goto('/');
|
||||
} catch (err) {
|
||||
error = 'Network error';
|
||||
error = 'Network error - ' + err;
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user