Refactor frontend into routed views with shared triage session state
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<script setup lang="ts">
|
||||
import { watch } from 'vue'
|
||||
import LanguageSelect from '../components/LanguageSelect.vue'
|
||||
import { useTriageSession } from '../composables/useTriageSession'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
const { language, isLoadingConfig, loadError, loadQuestions } = useTriageSession()
|
||||
|
||||
watch(
|
||||
() => language.value,
|
||||
() => {
|
||||
void loadQuestions()
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
function goNext() {
|
||||
if (!isLoadingConfig.value && !loadError.value) {
|
||||
router.push('/complaint')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section>
|
||||
<LanguageSelect v-model="language" />
|
||||
|
||||
<p v-if="isLoadingConfig" class="status">Konfiguration wird geladen ...</p>
|
||||
<p v-if="loadError" class="status error">{{ loadError }}</p>
|
||||
|
||||
<div class="actions">
|
||||
<button class="primary" type="button" :disabled="!!loadError || isLoadingConfig" @click="goNext">
|
||||
Weiter
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.status {
|
||||
margin-top: 1rem;
|
||||
font-size: 0.9rem;
|
||||
color: #4b5563;
|
||||
}
|
||||
|
||||
.status.error {
|
||||
color: #b91c1c;
|
||||
}
|
||||
|
||||
.actions {
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user