title: How to localstorage set users data (Problem with OPTIONS before post)
body: <p>I got problem with <code>axios.post</code>. How to resolve that?</p>
  <p><a href="https://i.stack.imgur.com/bv9j4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bv9j4.jpg" alt="enter image description here" /></a></p>
  <p>This is POST mapping return values.</p>
  <p>But first request is OPTIONS http request</p>
  <p><a href="https://i.stack.imgur.com/rU3Nh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rU3Nh.jpg" alt="enter image description here" /></a></p>
  <p>This is OPTIONS resp value.</p>
  <p>Then I accessed <code>window.localstorage.getItem(&quot;username&quot;, username)</code> then return Undefined.</p>
  <pre><code>export const doLogin = (body) =&gt; {
      console.log(process.env.REACT_APP_DB_HOST);
  
      const options = {
          method: 'POST',
          headers: {&quot;Content-Type&quot;: `application/json`},
          data: body,
          url: process.env.REACT_APP_DB_HOST + &quot;/login&quot;,
      };
  
      axios(options).then((res) =&gt;{
          const token = res.headers.authorization;
          const username = res.headers.username;
          const nickname = res.headers.nickname;
          console.log(&quot;===================&quot;)
          window.localStorage.setItem(&quot;token&quot;, token);
          window.localStorage.setItem(&quot;username&quot;, username);
          window.localStorage.setItem(&quot;nickname&quot;, nickname);
      })
  
  </code></pre>