Refactor dialog components in ProfilePage to use markRaw for improved performance. Update EmailDialog to correctly handle email state and emit close events. ChangeSlugDialog now initializes newSlug with the creator's slug.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import {ref} from 'vue';
|
||||
import {ref, markRaw} from 'vue';
|
||||
import {useCreatorProfileStore} from '@/stores/creatorProfileStore.js';
|
||||
import {useUserProfileStore} from "@/stores/userProfileStore.js";
|
||||
import SocialsDialog from './creators/SocialsDialog.vue';
|
||||
@@ -77,12 +77,12 @@ const dialogShown = ref(false);
|
||||
const currentComponent = ref('');
|
||||
|
||||
const componentsMap = {
|
||||
EmailDialog,
|
||||
SocialsDialog,
|
||||
ChangeSlugDialog,
|
||||
ChangeNameDialog,
|
||||
ChangeTitleDialog,
|
||||
ChangeStripeIdDialog,
|
||||
EmailDialog: markRaw(EmailDialog),
|
||||
SocialsDialog: markRaw(SocialsDialog),
|
||||
ChangeSlugDialog: markRaw(ChangeSlugDialog),
|
||||
ChangeNameDialog: markRaw(ChangeNameDialog),
|
||||
ChangeTitleDialog: markRaw(ChangeTitleDialog),
|
||||
ChangeStripeIdDialog: markRaw(ChangeStripeIdDialog),
|
||||
};
|
||||
|
||||
function requestCancel() {
|
||||
|
||||
@@ -35,33 +35,31 @@ const props = defineProps({
|
||||
creator: {
|
||||
required: true
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
const emits = defineEmits(['closeRequested'])
|
||||
const emits = defineEmits(['closeRequested']);
|
||||
|
||||
const email = ref(props.creator.email)
|
||||
const email = ref(props.creator.email);
|
||||
|
||||
const client = useClient()
|
||||
const client = useClient();
|
||||
const save = async () => {
|
||||
try {
|
||||
await client.post(
|
||||
`/api/creators/${props.creator.id}/email`,
|
||||
{
|
||||
"facebookUrl": facebookUrl.value
|
||||
})
|
||||
email: email.value
|
||||
});
|
||||
|
||||
props.creator.socials.facebookUrl = facebookUrl
|
||||
|
||||
emits('closeRequested')
|
||||
props.creator.email = email.value;
|
||||
emits('closeRequested');
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const cancel = () => {
|
||||
emits('closeRequested')
|
||||
}
|
||||
|
||||
emits('closeRequested');
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ const creatorProfileStore = useCreatorProfileStore();
|
||||
const client = useClient();
|
||||
const t = useTranslations();
|
||||
|
||||
const newSlug = ref('');
|
||||
const newSlug = ref(props.creator.slug);
|
||||
const slugReservationId = ref(undefined);
|
||||
const isOperationPending = ref(false);
|
||||
const errorMessage = ref('');
|
||||
|
||||
Reference in New Issue
Block a user