This commit is contained in:
j3d1 2024-06-09 18:34:46 +02:00
parent acf76c1d15
commit a4c1a6fc95
2 changed files with 3 additions and 4 deletions

View file

@ -446,6 +446,7 @@ const store = createStore({
}, },
async createMessageTemplate({commit, state}, template_name) { async createMessageTemplate({commit, state}, template_name) {
const {data, success} = await http.post('/2/message_templates/', {name: template_name}, state.user.token); const {data, success} = await http.post('/2/message_templates/', {name: template_name}, state.user.token);
const {data: newTemplates, success: newSuccess} = await http.get('/2/message_templates/', state.user.token);
if (data && success) { if (data && success) {
commit('setMessageTemplates', data); commit('setMessageTemplates', data);
} }

View file

@ -10,11 +10,9 @@
<div v-for="template in messageTemplatesIntermediate" :key="template.id" class="card bg-dark" <div v-for="template in messageTemplatesIntermediate" :key="template.id" class="card bg-dark"
style="margin-bottom: 10px;"> style="margin-bottom: 10px;">
<div class="card-header">{{ template.name }}</div> <div class="card-header">{{ template.name }}</div>
<FormatedText :value="template.message" :format="formatText" class="card-body"
@input="changeMessageTemplate(template.id, $event)"/>
<div class="card-body"> <div class="card-body">
<FormatedText :value="template.message" :format="formatText"
@input="changeMessageTemplate(template.id, $event)"/>
</div>
<div class="card-footer">
<button class="btn btn-primary" @click="resetMessageTemplate(template.id)" <button class="btn btn-primary" @click="resetMessageTemplate(template.id)"
:disabled="messageTemplates.find(t => t.id === template.id).message === template.message">Reset :disabled="messageTemplates.find(t => t.id === template.id).message === template.message">Reset
</button> </button>