title: VueJS How to Change Data Variable from a Function within Methods
body: <p>I have searched and to no avail cannot find a working solution to my problem.</p>
  
  <p>I am using Vue 3.1.3</p>
  
  <p>The issue I seem to be running into has something to do with accessing a variable stored in <code>data()</code> from within a method and changing that variable. </p>
  
  <p>Line 52, my goal is within <code>axios.post</code> if there is an error I want to catch it and then change the variable, <code>failedLogin</code>, within data, to true.</p>
  
  <p>Currently it is just set to <code>this.failedLogin = true</code> as I read in Vue documentation this is all you should need to be able to do, however I believe this is only if it is at the top of the methods and not within a function within methods.</p>
  
  <p>I have tried some other solutions such as </p>
  
  <ul>
  <li><code>this.$set(this.failedLogin, true);</code></li>
  <li><code>this.failedLogin.value = true</code></li>
  </ul>
  
  <p><a href="https://pastebin.com/sR1bB72v" rel="nofollow noreferrer">https://pastebin.com/sR1bB72v</a></p>