Add comprehensive recurring payments system with scheduling
- Add RecurringPayment model with flexible scheduling options - Implement node-cron based scheduler for payment processing - Create API endpoints for CRUD operations on recurring payments - Add recurring payments management UI with create/edit forms - Integrate scheduler initialization in hooks.server.ts - Enhance payments/add form with progressive enhancement - Add recurring payments button to main dashboard - Improve server-side rendering for better performance 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,38 @@
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { redirect, error } from '@sveltejs/kit';
|
||||
|
||||
export const load: PageServerLoad = async ({ locals }) => {
|
||||
export const load: PageServerLoad = async ({ locals, fetch }) => {
|
||||
const session = await locals.auth();
|
||||
|
||||
if (!session) {
|
||||
throw redirect(302, '/login');
|
||||
}
|
||||
|
||||
return {
|
||||
session
|
||||
};
|
||||
try {
|
||||
// Fetch both balance and debt data server-side using existing APIs
|
||||
const [balanceResponse, debtResponse] = await Promise.all([
|
||||
fetch('/api/cospend/balance'),
|
||||
fetch('/api/cospend/debts')
|
||||
]);
|
||||
|
||||
if (!balanceResponse.ok) {
|
||||
throw new Error('Failed to fetch balance');
|
||||
}
|
||||
|
||||
if (!debtResponse.ok) {
|
||||
throw new Error('Failed to fetch debt data');
|
||||
}
|
||||
|
||||
const balance = await balanceResponse.json();
|
||||
const debtData = await debtResponse.json();
|
||||
|
||||
return {
|
||||
session,
|
||||
balance,
|
||||
debtData
|
||||
};
|
||||
} catch (e) {
|
||||
console.error('Error loading dashboard data:', e);
|
||||
throw error(500, 'Failed to load dashboard data');
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user