mirror of
https://github.com/BeamMP/BeamMP-Website.git
synced 2026-10-26 05:50:33 +00:00
various changes
This commit is contained in:
1 parent
9c85fb2f10
commit
d5b7c52641
7 files changed
+33
-69
No files matched your search
@@ -15,18 +15,22 @@ import {
|
||||
} from 'lucide-vue-next'
|
||||
|
||||
const onlinePlayers = ref('...')
|
||||
const onlineServers = ref('...')
|
||||
const isLoading = ref(true)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const response = await fetch('https://backend.beammp.com/metrics')
|
||||
// beammp_players_online 2783 beammp_public_servers 2959 beammp_all_servers 4663
|
||||
const data = await response.text()
|
||||
const values = data.split(' ')
|
||||
if (values.length >= 2) {
|
||||
onlinePlayers.value = values[1]
|
||||
onlineServers.value = values[3]
|
||||
}
|
||||
} catch {
|
||||
onlinePlayers.value = 'N/A'
|
||||
onlineServers.value = 'N/A'
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user