title: Vue + Axios with sessionStorage
body: <p><strong>Goal:</strong> Initially load posts using the Wordpress Rest API via Axios once in a Vue View, and only once during a session of visiting the Vue website.</p>
  
  <p><strong>Current Result:</strong> I currently fetch the results successfully and set them in sessionStorage. They display correctly. I want to know/learn if I am accomplishing this correctly and have the process optimized in the best way possible. I've looked up documentation and I think I have it down.</p>
  
  <p><strong>Current Code:</strong></p>
  
  <pre><code>&lt;script&gt;
  import Hero from "@/components/Hero.vue";
  import axios from "axios";
  
  export default {
    name: "About",
    components: {
      Hero,
    },
    data: function() {
      return {
        eatery: [],
      };
    },
    created() {
      axios
        .get("//localhost:81/wp-json/wp/v2/posts?_embed&amp;per_page=5&amp;categories=2")
        .then((response) =&gt; {
          sessionStorage.setItem("eatery", JSON.stringify(response.data));
        })
        .catch((error) =&gt; {
          window.alert(error);
        });
    },
    mounted() {
      if (sessionStorage.getItem("eatery")) {
        this.eatery = JSON.parse(sessionStorage.getItem("eatery"));
      }
    },
  };
  &lt;/script&gt;
  </code></pre>