scaffold: Vue 3 frontend — router, stores, views, composables, layouts
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>
This commit is contained in:
52
frontend/src/stores/server.ts
Normal file
52
frontend/src/stores/server.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
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,
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user