✨ Add BaseModal import and simplify useAsyncState calls in ApiKeyManager and GamemasterManager views
This commit is contained in:
@@ -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 } =
|
||||
|
||||
@@ -203,13 +203,10 @@ const {
|
||||
data: serverStatus,
|
||||
loading: statusLoading,
|
||||
error: statusError
|
||||
} = useAsyncState(
|
||||
async () => {
|
||||
const response = await apiClient.get('/api/gamemaster/status');
|
||||
return response;
|
||||
},
|
||||
null
|
||||
);
|
||||
} = useAsyncState(async () => {
|
||||
const response = await apiClient.get('/api/gamemaster/status');
|
||||
return response;
|
||||
}, null);
|
||||
|
||||
// Fetch gamemaster state
|
||||
const {
|
||||
@@ -218,13 +215,10 @@ const {
|
||||
loading: gamemasterLoading,
|
||||
error: gamemasterError,
|
||||
reset: resetGamemaster
|
||||
} = useAsyncState(
|
||||
async () => {
|
||||
const data = await fetchLatestGamemaster();
|
||||
return data;
|
||||
},
|
||||
null
|
||||
);
|
||||
} = useAsyncState(async () => {
|
||||
const data = await fetchLatestGamemaster();
|
||||
return data;
|
||||
}, null);
|
||||
|
||||
// Save to server state
|
||||
const {
|
||||
@@ -232,22 +226,21 @@ const {
|
||||
loading: saving,
|
||||
error: saveError,
|
||||
reset: resetSave
|
||||
} = useAsyncState(
|
||||
async () => {
|
||||
const result = await apiClient.post('/api/gamemaster/process', {});
|
||||
// Reload server status after save
|
||||
await loadServerStatus();
|
||||
return result;
|
||||
},
|
||||
null
|
||||
);
|
||||
} = useAsyncState(async () => {
|
||||
const result = await apiClient.post('/api/gamemaster/process', {});
|
||||
// Reload server status after save
|
||||
await loadServerStatus();
|
||||
return result;
|
||||
}, 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;
|
||||
|
||||
Reference in New Issue
Block a user