Complete frontend skeleton: Vite + Vue 3 + TypeScript + Tailwind CSS, Pinia stores (auth, server, wipe, plugins), authenticated API composable, full route tree with auth guards, DashboardLayout with sidebar nav, 23 view stubs across auth/admin/public, all TypeScript interfaces. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
import { defineStore } from 'pinia'
|
|
import { ref } from 'vue'
|
|
import type { ServerConnection, ServerConfig, ServerStats } from '@/types'
|
|
|
|
export const useServerStore = defineStore('server', () => {
|
|
const connection = ref<ServerConnection | null>(null)
|
|
const config = ref<ServerConfig | null>(null)
|
|
const stats = ref<ServerStats | null>(null)
|
|
const isLoading = ref(false)
|
|
|
|
async function fetchServerStatus() {
|
|
// TODO: Fetch from API
|
|
}
|
|
|
|
async function fetchServerConfig() {
|
|
// TODO: Fetch from API
|
|
}
|
|
|
|
async function startServer() {
|
|
// TODO: POST /api/servers/:id/start
|
|
}
|
|
|
|
async function stopServer() {
|
|
// TODO: POST /api/servers/:id/stop
|
|
}
|
|
|
|
async function restartServer() {
|
|
// TODO: POST /api/servers/:id/restart
|
|
}
|
|
|
|
async function sendCommand(command: string) {
|
|
// TODO: POST /api/servers/:id/command
|
|
}
|
|
|
|
function updateStats(newStats: ServerStats) {
|
|
stats.value = newStats
|
|
}
|
|
|
|
return {
|
|
connection,
|
|
config,
|
|
stats,
|
|
isLoading,
|
|
fetchServerStatus,
|
|
fetchServerConfig,
|
|
startServer,
|
|
stopServer,
|
|
restartServer,
|
|
sendCommand,
|
|
updateStats,
|
|
}
|
|
})
|