This commit is contained in:
2026-04-10 15:26:51 +03:00
parent a8a2239d37
commit 5821006bf2
68 changed files with 3292 additions and 19 deletions

View File

@@ -0,0 +1,43 @@
<template>
<div>
<h2>Dashboard</h2>
<button @click="logout">Logout</button>
<h3>Users</h3>
<table>
<thead>
<tr><th>ID</th><th>Login</th><th>Created</th><th>IP</th></tr>
</thead>
<tbody>
<tr v-for="user in users" :key="user.id">
<td>{{ user.id }}</td>
<td>{{ user.login }}</td>
<td>{{ user.created }}</td>
<td>{{ user.ip }}</td>
</tr>
</tbody>
</table>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import axios from 'axios'
const router = useRouter()
const users = ref([])
onMounted(async () => {
try {
const res = await axios.get('/api/admin/users')
users.value = res.data
} catch {
router.push('/login')
}
})
async function logout() {
await axios.post('/api/logout')
router.push('/login')
}
</script>