summaryrefslogtreecommitdiff
path: root/public/js/form.js
blob: 1752f559e6f366fdc65353c02f06b4e1570ddd7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//function sendMessage(){}

function changeRecipient(id){
	const email = document.getElementById('recipient').value;
    const warning = document.querySelector('.no_recipient_warning');

	fetch('index.php?action=recipient_email', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({ id: id, email: email })
    })
    .then(response => response.json())
    .then(data => {
        if(data.success){
            warning.classList.add('hidden');
        	toastNotify('Adresse e-mail de destination modifiée');
        }
        else{
            console.error('Erreur: echec de la modification de l\'adresse e-mail de destination');
        }
    })
    .catch(error => {
        console.error('Erreur:', error);
    });
}