Fix Cancel button when creating a new Creator
This commit is contained in:
@@ -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() {
|
||||
|
||||
<div class="card-actions">
|
||||
<button
|
||||
:disabled="!canSave"
|
||||
class="secondary"
|
||||
@click="createAccount">
|
||||
@click="cancel">
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user