migrate to nextjs

This commit is contained in:
Fran Jurmanović
2025-08-27 20:38:19 +02:00
parent 965e13a0bf
commit b269144ee7
120 changed files with 10393 additions and 8526 deletions

View File

@@ -0,0 +1,38 @@
'use server';
import { revalidatePath } from 'next/cache';
import { requireAuth } from '@/lib/auth/server';
import { startService, stopService, restartService } from '@/lib/api/server/servers';
export async function startServerAction(serverId: string) {
try {
const session = await requireAuth();
await startService(session.token!, serverId);
revalidatePath('/dashboard');
revalidatePath(`/dashboard/server/${serverId}`);
} catch (error) {
throw new Error(error instanceof Error ? error.message : 'Failed to start server');
}
}
export async function stopServerAction(serverId: string) {
try {
const session = await requireAuth();
await stopService(session.token!, serverId);
revalidatePath('/dashboard');
revalidatePath(`/dashboard/server/${serverId}`);
} catch (error) {
throw new Error(error instanceof Error ? error.message : 'Failed to stop server');
}
}
export async function restartServerAction(serverId: string) {
try {
const session = await requireAuth();
await restartService(session.token!, serverId);
revalidatePath('/dashboard');
revalidatePath(`/dashboard/server/${serverId}`);
} catch (error) {
throw new Error(error instanceof Error ? error.message : 'Failed to restart server');
}
}