70 lines
1.2 KiB
Vue
70 lines
1.2 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 name = ref(props.creator.name);
|
|
|
|
const client = useClient();
|
|
|
|
async function save() {
|
|
try {
|
|
await client.post(
|
|
`/api/creators/${props.creator.id}/name`,
|
|
{
|
|
name: name.value
|
|
}
|
|
);
|
|
|
|
props.creator.name = name.value;
|
|
emits('closeRequested');
|
|
} catch (error) {
|
|
console.error('Error saving title:', error);
|
|
}
|
|
}
|
|
|
|
const cancel = () => {
|
|
emits('closeRequested');
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<div class="card dialog">
|
|
|
|
<div class="card-title">
|
|
Modifier le Nom
|
|
</div>
|
|
|
|
<div class="card-content">
|
|
<v-text-field
|
|
v-model="name"
|
|
label="Name"
|
|
outlined
|
|
variant="outlined"
|
|
></v-text-field>
|
|
|
|
<div class="card-actions">
|
|
<button class="secondary"
|
|
@click="cancel">
|
|
Annuler
|
|
</button>
|
|
<button class="primary"
|
|
@click="save">
|
|
Enregistrer
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|