Co-authored-by: dbroqua <contact@darkou.fr> Reviewed-on: https://git.darkou.fr/dbroqua/MusicTopus/pulls/58
This commit is contained in:
parent
b8b3df2932
commit
2da6afa06d
9 changed files with 134 additions and 10 deletions
|
@ -185,7 +185,6 @@
|
|||
const entries = urlParams.entries();
|
||||
|
||||
for(const entry of entries) {
|
||||
console.log(`${entry[0]}: ${entry[1]}`);
|
||||
switch(entry[0]) {
|
||||
case 'artists_sort':
|
||||
this.artist = entry[1];
|
||||
|
|
|
@ -239,7 +239,6 @@
|
|||
const entries = urlParams.entries();
|
||||
|
||||
for(const entry of entries) {
|
||||
console.log(`${entry[0]}: ${entry[1]}`);
|
||||
switch(entry[0]) {
|
||||
case 'artists_sort':
|
||||
this.artist = entry[1];
|
||||
|
|
|
@ -1,22 +1,70 @@
|
|||
<section class="box">
|
||||
<section class="box" id="app">
|
||||
<h1>Nous contacter</h1>
|
||||
<form action="https://formspree.io/f/<%= config.formspreeId %>" method="POST">
|
||||
<form @submit="send" <% if (config.mailMethod === 'formspree' ) { %> id="contact" method="POST" action="https://formspree.io/f/<%= config.formspreeId %>" <% } %>>
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-16">
|
||||
<div class="field">
|
||||
<label for="email">Addresse e-mail*</label>
|
||||
<input type="email" name="email" id="email" required />
|
||||
<input type="email" name="email" id="email" v-model="email" required />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="name">Prénom, nom</label>
|
||||
<input type="text" name="name" id="name" />
|
||||
<input type="text" name="name" id="name" v-model="name" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="message">Message*</label>
|
||||
<textarea name="message" id="message" rows="6" required ></textarea>
|
||||
<textarea name="message" id="message" rows="6" required v-model="message" ></textarea>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="button is-primary">Envoyer</button>
|
||||
<button type="submit" class="button is-primary" :disabled="loading">
|
||||
<% if (config.mailMethod !== 'formspree' ) { %>
|
||||
<i class="icon-spin animate-spin" v-if="loading"></i>
|
||||
<% } %>
|
||||
Envoyer
|
||||
</button>
|
||||
</form>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<% if (config.mailMethod === 'smtp' ) { %>
|
||||
<script>
|
||||
Vue.createApp({
|
||||
data() {
|
||||
return {
|
||||
email: '',
|
||||
name: '',
|
||||
message: '',
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
send(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if ( this.loading ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
|
||||
const {
|
||||
email,
|
||||
message,
|
||||
name
|
||||
} = this;
|
||||
|
||||
axios.post('/api/v1/contact', {email, name, message})
|
||||
.then( () => {
|
||||
showToastr("Message correctement envoyé", true);
|
||||
})
|
||||
.catch((err) => {
|
||||
showToastr(err.response?.data?.message || "Impossible d'envoyer votre message", false);
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
},
|
||||
}).mount('#app');
|
||||
</script>
|
||||
<% } %>
|
Loading…
Add table
Add a link
Reference in a new issue