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,30 @@
import { fetchServerAPI } from './base';
import { Server } from '@/lib/types/server';
const serverRoute = '/server';
export async function getServers(token: string): Promise<Server[]> {
const response = await fetchServerAPI<Server[]>(serverRoute, token);
return response;
}
export async function getServer(token: string, serverId: string): Promise<Server> {
const response = await fetchServerAPI<Server>(`${serverRoute}/${serverId}`, token);
return response;
}
export async function restartService(token: string, serverId: string) {
return fetchServerAPI(`${serverRoute}/${serverId}/service/restart`, token, 'POST');
}
export async function startService(token: string, serverId: string) {
return fetchServerAPI(`${serverRoute}/${serverId}/service/start`, token, 'POST');
}
export async function stopService(token: string, serverId: string) {
return fetchServerAPI(`${serverRoute}/${serverId}/service/stop`, token, 'POST');
}
export async function getServiceStatus(token: string, serverId: string) {
return fetchServerAPI(`${serverRoute}/${serverId}/service`, token);
}