Add BaseModal import and simplify useAsyncState calls in ApiKeyManager and GamemasterManager views

This commit is contained in:
2026-01-28 22:42:01 +00:00
parent 0515fb7958
commit ae8832daff
2 changed files with 18 additions and 24 deletions

View File

@@ -160,6 +160,7 @@
<script setup>
import { ref } from 'vue';
import ChallongeApiKeyGuide from '../components/ChallongeApiKeyGuide.vue';
import { BaseModal } from '../components/shared/index.js';
import { useChallongeApiKey } from '../composables/useChallongeApiKey.js';
const { saveApiKey, clearApiKey, maskedKey, isKeyStored } =

View File

@@ -203,13 +203,10 @@ const {
data: serverStatus,
loading: statusLoading,
error: statusError
} = useAsyncState(
async () => {
} = useAsyncState(async () => {
const response = await apiClient.get('/api/gamemaster/status');
return response;
},
null
);
}, null);
// Fetch gamemaster state
const {
@@ -218,13 +215,10 @@ const {
loading: gamemasterLoading,
error: gamemasterError,
reset: resetGamemaster
} = useAsyncState(
async () => {
} = useAsyncState(async () => {
const data = await fetchLatestGamemaster();
return data;
},
null
);
}, null);
// Save to server state
const {
@@ -232,22 +226,21 @@ const {
loading: saving,
error: saveError,
reset: resetSave
} = useAsyncState(
async () => {
} = useAsyncState(async () => {
const result = await apiClient.post('/api/gamemaster/process', {});
// Reload server status after save
await loadServerStatus();
return result;
},
null
);
}, null);
// Process gamemaster data
const processedData = ref(null);
const saveSuccess = ref(false);
// Combine error states for template
const error = computed(() => gamemasterError.value || statusError.value || saveError.value);
const error = computed(
() => gamemasterError.value || statusError.value || saveError.value
);
const stats = computed(() => {
if (!processedData.value) return null;