ux: Route user to team page after saving an event

Fixes #7
master
John Montagu, the 4th Earl of Sandvich 2025-05-21 10:34:52 -07:00
parent aefb9c30f1
commit d2b4c2d33a
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
1 changed files with 15 additions and 10 deletions

View File

@ -1,4 +1,5 @@
<script setup lang="ts">
import type { CancelablePromise, EventSchema } from "@/client";
import { useEventForm } from "@/composables/event-form";
import { useTeamDetails } from "@/composables/team-details";
import { useEventsStore } from "@/stores/events";
@ -38,19 +39,23 @@ const startTimeTeamTz = computed(() => {
});
function saveRoster() {
let promise: CancelablePromise<EventSchema>;
if (eventId.value) {
rosterStore.updateRoster(eventId.value);
promise = rosterStore.updateRoster(eventId.value);
} else {
rosterStore.saveRoster(Number(route.params.teamId))
.then(() => {
router.push({
name: "team-details",
params: {
id: route.params.teamId
}
});
});
promise = rosterStore.saveRoster(Number(route.params.teamId));
}
promise
.then((event) => {
router.push({
name: "team-details",
params: {
id: event.teamId,
}
});
});
}
onMounted(() => {