[Vuejs]-Axios get request depending on user data fails

0👍

You are missing the whole mounted function in the script

<template>
  <div>
    {{ this.$auth.$storage.state.user.email }}
  </div>
</template>

<script>
import axios from "axios";

export default {
  mounted() {
    axios
      .get(
        "/api/v1/is-success-or-not?email=" +
          this.$auth.$storage.state.user.email
      )
      .then((response) => {
        if (response.data === "True") {
          console.log("Player is success");
          $nuxt.$router.push("/schedule");
        }
      });

    axios
      .get("failureornot?email=" + this.$auth.$storage.state.user.email)
      .then((response) => {
        if (response.data > 3) {
          console.log("failure");
          $nuxt.$router.push("/failure");
        }
      });
  },
};
</script>

Leave a comment