<template>
  <div>
    <h2>Server Status</h2>
    <p>Server is running</p>
    <button @click="refreshStatus">Refresh Status</button>
    <p v-if="status">{{ status }}</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      status: ''
    }
  },
  methods: {
    async refreshStatus() {
      try {
        const response = await fetch('/api/status')
        if (response.ok) {
          const data = await response.json()
          this.status = data.status
        } else {
          this.status = 'Failed to fetch status'
        }
      } catch (err) {
        this.status = 'Failed to fetch status'
      }
    }
  }
}
</script>