Adds edition of slug.
This commit is contained in:
69
frontend/src/views/profile/creators/ChangeNameDialog.vue
Normal file
69
frontend/src/views/profile/creators/ChangeNameDialog.vue
Normal file
@@ -0,0 +1,69 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user