Renames SocialNetworks to Socials

This commit is contained in:
Jonathan Bourdon
2024-08-06 00:15:53 -04:00
parent fd1937b56f
commit f4b060dd9d
3 changed files with 62 additions and 63 deletions

View File

@@ -0,0 +1,123 @@
<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.socials.facebookUrl)
const instagramUrl = ref(props.creator.socials.instagramUrl)
const linkedInUrl = ref(props.creator.socials.linkedInUrl)
const redditUrl = ref(props.creator.socials.redditUrl)
const tikTokUrl = ref(props.creator.socials.tikTokUrl)
const websiteUrl = ref(props.creator.socials.websiteUrl)
const xUrl = ref(props.creator.socials.xUrl)
const youtubeUrl = ref(props.creator.socials.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.socials.facebookUrl = facebookUrl
props.creator.socials.instagramUrl = instagramUrl
props.creator.socials.linkedInUrl = linkedInUrl
props.creator.socials.redditUrl = redditUrl
props.creator.socials.tikTokUrl = tikTokUrl
props.creator.socials.websiteUrl = websiteUrl
props.creator.socials.xUrl = xUrl
props.creator.socials.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>