<template>
    <div>
      <h2>Activate Account</h2>
      <button @click="activate">Activate</button>
    </div>
  </template>
  
  <script>
  import axios from 'axios';
  
  export default {
    methods: {
      async activate() {
        try {
          const activationCode = this.$route.params.activationCode;
          await axios.get(`/api/auth/activate/${activationCode}`);
          alert('Account activated! You can now log in.');
          this.$router.push('/login');
        } catch (error) {
          console.error(error);
          alert('Activation failed.');
        }
      },
    },
  };
  </script>
  