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 {useUserProfileStore} from "@/stores/userProfileStore.js";
|
||||||
import {useCreatorProfileStore} from "@/stores/creatorProfileStore.js";
|
import {useCreatorProfileStore} from "@/stores/creatorProfileStore.js";
|
||||||
import {useClient} from "@/plugins/api.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";
|
import NameEditor from "@/views/creators/NameEditor.vue";
|
||||||
|
|
||||||
const creatorName = ref('');
|
const creatorName = ref('');
|
||||||
@@ -14,14 +14,26 @@ const isOperationPending = ref(false);
|
|||||||
const errorMessage = ref('');
|
const errorMessage = ref('');
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const route = useRoute();
|
||||||
const creatorProfileStore = useCreatorProfileStore();
|
const creatorProfileStore = useCreatorProfileStore();
|
||||||
const userProfileStore = useUserProfileStore();
|
const userProfileStore = useUserProfileStore();
|
||||||
|
|
||||||
function handleCreatorNameReservationIdChanged($event) {
|
function handleCreatorNameReservationIdChanged($event) {
|
||||||
console.log(`in handleCreatorNameReservationIdChanged: ${$event.value}`);
|
|
||||||
creatorNameReservationId.value = $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)!
|
// TODO: The `fetchCreatorProfile` function should be private (push-up to the store)!
|
||||||
async function createAccount() {
|
async function createAccount() {
|
||||||
try {
|
try {
|
||||||
@@ -65,9 +77,8 @@ async function createAccount() {
|
|||||||
|
|
||||||
<div class="card-actions">
|
<div class="card-actions">
|
||||||
<button
|
<button
|
||||||
:disabled="!canSave"
|
|
||||||
class="secondary"
|
class="secondary"
|
||||||
@click="createAccount">
|
@click="cancel">
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
|
|||||||
Reference in New Issue
Block a user