124 lines
3.1 KiB
Vue
124 lines
3.1 KiB
Vue
<script setup>
|
|
import {ref} from 'vue'
|
|
import {useClient} from "@/plugins/api.js";
|
|
|
|
const props = defineProps({
|
|
creator: {
|
|
required: true
|
|
}
|
|
})
|
|
|
|
const emits = defineEmits(['closeRequested'])
|
|
|
|
const facebookUrl = ref(props.creator.socialNetworks.facebookUrl)
|
|
const instagramUrl = ref(props.creator.socialNetworks.instagramUrl)
|
|
const linkedInUrl = ref(props.creator.socialNetworks.linkedInUrl)
|
|
const redditUrl = ref(props.creator.socialNetworks.redditUrl)
|
|
const tikTokUrl = ref(props.creator.socialNetworks.tikTokUrl)
|
|
const websiteUrl = ref(props.creator.socialNetworks.websiteUrl)
|
|
const xUrl = ref(props.creator.socialNetworks.xUrl)
|
|
const youtubeUrl = ref(props.creator.socialNetworks.youtubeUrl)
|
|
|
|
const client = useClient()
|
|
const save = async () => {
|
|
try {
|
|
await client.post(
|
|
`/api/creators/${props.creator.id}/socials`,
|
|
{
|
|
"facebookUrl": facebookUrl.value || null,
|
|
"instagramUrl": instagramUrl.value || null,
|
|
"linkedInUrl": linkedInUrl.value || null,
|
|
"redditUrl": redditUrl.value || null,
|
|
"tikTokUrl": tikTokUrl.value || null,
|
|
"websiteUrl": websiteUrl.value || null,
|
|
"xUrl": xUrl.value || null,
|
|
"youtubeUrl": youtubeUrl.value || null,
|
|
})
|
|
|
|
props.creator.socialNetworks.facebookUrl = facebookUrl
|
|
props.creator.socialNetworks.instagramUrl = instagramUrl
|
|
props.creator.socialNetworks.linkedInUrl = linkedInUrl
|
|
props.creator.socialNetworks.redditUrl = redditUrl
|
|
props.creator.socialNetworks.tikTokUrl = tikTokUrl
|
|
props.creator.socialNetworks.websiteUrl = websiteUrl
|
|
props.creator.socialNetworks.xUrl = xUrl
|
|
props.creator.socialNetworks.youtubeUrl = youtubeUrl
|
|
|
|
emits('closeRequested')
|
|
} catch (error) {
|
|
console.error(error)
|
|
}
|
|
}
|
|
|
|
const cancel = () => {
|
|
emits('closeRequested')
|
|
}
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<div class="pb-5 text-2xl">Reseaux Sociaux</div>
|
|
|
|
<v-text-field
|
|
variant="outlined"
|
|
v-model="facebookUrl"
|
|
label="Lien Facebook"
|
|
outlined
|
|
></v-text-field>
|
|
|
|
<v-text-field
|
|
variant="outlined"
|
|
v-model="instagramUrl"
|
|
label="Lien Instagram"
|
|
outlined
|
|
></v-text-field>
|
|
|
|
|
|
<v-text-field
|
|
variant="outlined"
|
|
v-model="linkedInUrl"
|
|
label="Lien LinkedIn"
|
|
outlined
|
|
></v-text-field>
|
|
|
|
<v-text-field
|
|
variant="outlined"
|
|
v-model="redditUrl"
|
|
label="Lien Reddit"
|
|
outlined
|
|
></v-text-field>
|
|
|
|
<v-text-field
|
|
variant="outlined"
|
|
v-model="tikTokUrl"
|
|
label="Lien TikTok"
|
|
outlined
|
|
></v-text-field>
|
|
|
|
<v-text-field
|
|
variant="outlined"
|
|
v-model="websiteUrl"
|
|
label="Lien site web"
|
|
outlined
|
|
></v-text-field>
|
|
|
|
<v-text-field
|
|
variant="outlined"
|
|
v-model="xUrl"
|
|
label="Lien X"
|
|
outlined
|
|
></v-text-field>
|
|
|
|
<v-text-field
|
|
variant="outlined"
|
|
v-model="youtubeUrl"
|
|
label="Lien Youtube"
|
|
outlined
|
|
></v-text-field>
|
|
|
|
<div class="flex justify-end space-x-4">
|
|
<v-btn color="black" variant="text" @click="cancel">Annuler</v-btn>
|
|
<v-btn color="#A6147D" @click="save">Enregistrer</v-btn>
|
|
</div>
|
|
</template>
|