You've already forked isop-mirror
fix: add error handling for fetch response in internship edit page
This commit is contained in:
@@ -20,7 +20,7 @@ const client = useSanctumClient();
|
||||
const loading = ref(false);
|
||||
const action_error = ref(null as null | string);
|
||||
|
||||
const { data, refresh } = await useSanctumFetch<Internship>(`/api/internships/${route.params.id}`);
|
||||
const { data, error, refresh } = await useSanctumFetch<Internship>(`/api/internships/${route.params.id}`);
|
||||
|
||||
async function handleUpdateOfBasicInfo(internship: NewInternship) {
|
||||
action_error.value = null;
|
||||
@@ -57,6 +57,10 @@ async function handleUpdateOfBasicInfo(internship: NewInternship) {
|
||||
<!-- Chybová hláška -->
|
||||
<ErrorAlert v-if="action_error" :error="action_error" />
|
||||
|
||||
<!-- Chybová hláška -->
|
||||
<ErrorAlert v-if="error" :error="error.message" />
|
||||
|
||||
<div v-else>
|
||||
<div>
|
||||
<h2>Základné informácie</h2>
|
||||
<ErrorAlert v-if="data?.status.status !== InternshipStatus.SUBMITTED"
|
||||
@@ -89,6 +93,7 @@ async function handleUpdateOfBasicInfo(internship: NewInternship) {
|
||||
|
||||
<InternshipDocumentEditor v-else :internship="data!" @successful-submit="refresh" />
|
||||
</div>
|
||||
</div>
|
||||
</v-card>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user