import { fetchServerAPI } from './base'; import type { Configurations, ConfigFile, Config } from '@/lib/types/config'; const serverRoute = '/server'; export async function getServerConfigurations( token: string, serverId: string ): Promise { const response = await fetchServerAPI(`${serverRoute}/${serverId}/config`, token); return response.data!; } export async function getServerConfiguration( token: string, serverId: string, configType: ConfigFile ): Promise { const response = await fetchServerAPI( `${serverRoute}/${serverId}/config/${configType}`, token ); return response.data!; } export async function updateServerConfiguration( token: string, serverId: string, configType: ConfigFile, config: Config, restart = false ): Promise { await fetchServerAPI(`${serverRoute}/${serverId}/config/${configType}`, token, 'PUT', { ...config, restart }); }