<template>
  <section class="hero is-info is-fullheight-with-navbar">
    <div class="hero-body">
      <div class="container">
        <div class="box" v-if="$store.state.emailVerified">
          <article class="media">
            <div class="media-content">
              <center>
                <i class="fas fa-envelope-open" style="color:#0a8bff; font-size: 30px;"></i>
                <div class="content">
                  <h1>Your email is now verified.</h1>
                  <p>You now have full access to the Kaverti website!</p>
                </div>
              </center>
            </div>
          </article>
        </div>
      </div>
    </div>
  </section>
</template>
<script>
  import logger from "../../assets/js/logger";

  export default {
    name: 'verification',
    data() {
      return {
        token: '',
        verification: {
          loading: false
        }
      }
    },
    watch: {
      created() {
        if (this.$route.query.token) {
          this.$store.commit('setEmailToken', this.$route.query.emailToken)
        }
      },
    },
    mounted () {
      this.$store.dispatch('setTitle', 'Email Verification')
      this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'userinfo')
        .then(res => {
          this.$store.commit('setUsername', res.data.username)
          this.$store.commit('setEmail', res.data.email)
          this.$store.commit('setEmailVerified', res.data.emailVerified)
          this.$store.commit('setAdmin', res.data.admin)
        })
        .catch(e => {
          this.showConn(e)
        })
      logger('settingsAccount')
    }
  }
</script>
