title: Nuxt.js - ssr, Error Cannot set headers after they are sent to the client
body: <p>I am having this problem in nuxt.js-ssr environment.</p>
  <pre><code> ERROR  Cannot set headers after they are sent to the client  
     at ServerResponse.setHeader (_http_outgoing.js:535:11)
     at p (node_modules/cookie-universal/dist/cookie-universal-common.js:1:1399)
     at Object.set (node_modules/cookie-universal/dist/cookie-universal-common.js:1:1836)
     at pages/index.js:145:21
     at processTicksAndRejections (internal/process/task_queues.js:97:5)
  </code></pre>
  <p>The reason?
  Occurs when nuxt fetch(SSR) calls API and writes cookie information in response</p>
  <pre><code>protected async fetch() {
    axios.get('https://api.onstove.com/test/test')
    .then((value: AxiosResponse&lt;Test&gt;) =&gt; {
        console.log('data ::', value.data);
    })
    .then(() =&gt; {
        console.log('cookie before ===&gt; ', this.$cookies.get('T1'));
        this.$cookies.set('T1', 'test122sdfdsfsfds34342');
        console.log('cookie after ===&gt; ', this.$cookies.get('T1'));
    });
  </code></pre>
  <p>}</p>
  <p>Let me know if anyone solved it.</p>