new Vue({
    el: '#app',
    data: {
      username: '',
      password: '',
      rememberMe: false,
      error: '',
      success: ''
    },
    methods: {
      login() {
        const DOLAPIKEY = '2139d15a5867882fa53f5daf98e82030d138b4d7';
        axios.post('https://furytech-sa.com/voodoo/api/index.php/login', {
          login: this.username,
          password: this.password
        }, {
          headers: {
            'DOLAPIKEY': DOLAPIKEY
          }
        })
        .then(response => {
          this.success = 'Connexion réussie !';
          this.error = '';
          console.log('Réponse de l\'API:', response.data);
          // Clear success message after 5 seconds
          setTimeout(() => {
            this.success = '';
          }, 5000);
        })
        .catch(error => {
          console.error('Erreur lors de la connexion:', error);
          this.error = 'Nom d\'utilisateur ou mot de passe incorrect';
          this.success = '';
          // Clear error message after 5 seconds
          setTimeout(() => {
            this.error = '';
          }, 5000);
        });
      }
    }
  });
  