up
This commit is contained in:
37
frontend/src/views/AdminSettings.vue
Normal file
37
frontend/src/views/AdminSettings.vue
Normal file
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<AppLayout>
|
||||
<div class="card">
|
||||
<h1 class="text-2xl font-bold mb-6">Application Settings</h1>
|
||||
<form @submit.prevent="saveSettings" class="space-y-4 max-w-lg">
|
||||
<div v-for="(value, key) in settings" :key="key">
|
||||
<label class="block text-sm font-medium text-gray-700">{{ key }}</label>
|
||||
<input v-model="settings[key]" type="text" class="input-field mt-1" />
|
||||
</div>
|
||||
<button type="submit" class="btn-primary">Save Changes</button>
|
||||
</form>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import AppLayout from '../components/Layout/AppLayout.vue'
|
||||
|
||||
const settings = ref<Record<string, string>>({})
|
||||
|
||||
async function loadSettings() {
|
||||
const res = await fetch('/api/settings')
|
||||
settings.value = await res.json()
|
||||
}
|
||||
|
||||
async function saveSettings() {
|
||||
await fetch('/api/admin/settings', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(settings.value)
|
||||
})
|
||||
alert('Settings saved')
|
||||
}
|
||||
|
||||
onMounted(loadSettings)
|
||||
</script>
|
||||
Reference in New Issue
Block a user