auto-reload for admin + auto validation for all using python
This commit is contained in:
@@ -7,6 +7,7 @@ import { apiService, errorHelpers } from '@/services/apiService'
|
||||
import { usePuzzlesStore } from '@/stores/puzzles'
|
||||
import { useSubmissionsStore } from '@/stores/submissions'
|
||||
import type { SteamCollection, PuzzleResponse, UserInfo } from '@/types'
|
||||
import { useCountdown } from '@vueuse/core'
|
||||
|
||||
const props = defineProps<{collectionTitle: string, collectionUrl: string, collectionDescription: string}>()
|
||||
|
||||
@@ -19,8 +20,6 @@ const userInfo = ref<UserInfo | null>(null)
|
||||
const isLoading = ref(true)
|
||||
const error = ref<string>('')
|
||||
|
||||
// Mock data removed - using API data only
|
||||
|
||||
// Computed properties
|
||||
const isSuperuser = computed(() => {
|
||||
return userInfo.value?.is_superuser || false
|
||||
@@ -42,7 +41,7 @@ const responsesByPuzzle = computed(() => {
|
||||
return grouped
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
async function initialize() {
|
||||
try {
|
||||
isLoading.value = true
|
||||
error.value = ''
|
||||
@@ -78,6 +77,20 @@ onMounted(async () => {
|
||||
isLoading.value = false
|
||||
console.log('Loading state set to false')
|
||||
}
|
||||
|
||||
if (userInfo.value.is_superuser) {
|
||||
start()
|
||||
}
|
||||
}
|
||||
|
||||
const { remaining, start } = useCountdown(60, {
|
||||
onComplete() {
|
||||
initialize()
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await initialize()
|
||||
})
|
||||
|
||||
const handleSubmission = async (submissionData: {
|
||||
@@ -165,6 +178,15 @@ const reloadPage = () => {
|
||||
<!-- Main Content -->
|
||||
<div class="container mx-auto px-4 py-8">
|
||||
<!-- Loading State -->
|
||||
<div v-if="userInfo?.is_superuser" class="flex justify-center">
|
||||
<div class="text-center">
|
||||
<p class="mb-6 text-base-content/70">
|
||||
<span class="loading loading-spinner loading-lg"></span>
|
||||
Auto reload page in {{ remaining }} seconds ...
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="isLoading" class="flex justify-center items-center min-h-[400px]">
|
||||
<div class="text-center">
|
||||
<span class="loading loading-spinner loading-lg"></span>
|
||||
|
||||
Reference in New Issue
Block a user