diff --git a/frontend/src/views/creators/CreateCreator.vue b/frontend/src/views/creators/CreateCreator.vue index c6fe85e..e1484c4 100644 --- a/frontend/src/views/creators/CreateCreator.vue +++ b/frontend/src/views/creators/CreateCreator.vue @@ -3,7 +3,7 @@ import {computed, ref} from 'vue' import {useUserProfileStore} from "@/stores/userProfileStore.js"; import {useCreatorProfileStore} from "@/stores/creatorProfileStore.js"; import {useClient} from "@/plugins/api.js"; -import {useRouter} from "vue-router"; +import {useRouter, useRoute} from "vue-router"; import NameEditor from "@/views/creators/NameEditor.vue"; const creatorName = ref(''); @@ -14,14 +14,26 @@ const isOperationPending = ref(false); const errorMessage = ref(''); const router = useRouter(); +const route = useRoute(); const creatorProfileStore = useCreatorProfileStore(); const userProfileStore = useUserProfileStore(); function handleCreatorNameReservationIdChanged($event) { - console.log(`in handleCreatorNameReservationIdChanged: ${$event.value}`); creatorNameReservationId.value = $event.value } +function cancel () { + // if a returnUrl query‑string was supplied, prefer it + const returnUrl = route.query.returnUrl + if (typeof returnUrl === 'string' && returnUrl.length) { + router.push(returnUrl) + return + } + + // otherwise just go back one step in history + router.back() +} + // TODO: The `fetchCreatorProfile` function should be private (push-up to the store)! async function createAccount() { try { @@ -65,9 +77,8 @@ async function createAccount() {