Fix Cancel button when creating a new Creator

This commit is contained in:
2025-04-09 15:48:43 -04:00
parent 35b640a802
commit 837458c526

View File

@@ -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 querystring 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() {
<div class="card-actions">
<button
:disabled="!canSave"
class="secondary"
@click="createAccount">
@click="cancel">
Cancel
</button>
<button