{"action":"opened","issue":{"url":"https://api.github.com/repos/nuxt/nuxt.js/issues/1501","repository_url":"https://api.github.com/repos/nuxt/nuxt.js","labels_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/1501/labels{/name}","comments_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/1501/comments","events_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/1501/events","html_url":"https://github.com/nuxt/nuxt.js/issues/1501","id":253239494,"number":1501,"title":"in nuxtServerInit  when i use axios to post body first is ok and second the body is nothing?","user":{"login":"zppro","id":706344,"avatar_url":"https://avatars2.githubusercontent.com/u/706344?v=4","gravatar_id":"","url":"https://api.github.com/users/zppro","html_url":"https://github.com/zppro","followers_url":"https://api.github.com/users/zppro/followers","following_url":"https://api.github.com/users/zppro/following{/other_user}","gists_url":"https://api.github.com/users/zppro/gists{/gist_id}","starred_url":"https://api.github.com/users/zppro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zppro/subscriptions","organizations_url":"https://api.github.com/users/zppro/orgs","repos_url":"https://api.github.com/users/zppro/repos","events_url":"https://api.github.com/users/zppro/events{/privacy}","received_events_url":"https://api.github.com/users/zppro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-08-28T06:39:45Z","updated_at":"2017-08-28T06:39:45Z","closed_at":null,"body":"```\r\n\"axios\": \"^0.16.2\",\r\n \"nuxt\": \"^1.0.0-rc6\",\r\n \"qs\": \"^6.5.0\"\r\n\r\n```\r\nstore/index.js\r\n```\r\n\r\nexport const actions = {\r\n  async nuxtServerInit ({state, commit, dispatch}, {app, req, res}) {\r\n    try {\r\n      console.log('--------------------nuxtServerInit:')\r\n\r\n      const api_token_ts = await app.api.post(`/share/auth/apiToken`, { path: 'apps/99alive', username: 'aaaa' })\r\n      const apiToken = await app.api(`/apps/99alive/apiToken`)\r\n      console.log(apiToken)\r\n\r\n      let urls = [\r\n        app.api(`/share/keys.json`),\r\n        app.api(`/share/district/cities/,_id name first_letter hot`),\r\n        ...state.tpa._searchDimensionIds.map(o => app.api(`/share/dictionary/${o}/pair`))\r\n      ]\r\n      // console.log('urls: ', urls)\r\n      await axios.all(urls).then(axios.spread(($keys, cities, ...searchDimensions) => {\r\n        commit(indexTypes.SET_$KEYS, $keys)\r\n        commit(indexTypes.SET_CITIES, cities)\r\n        commit(tpaPrefix + '/'+ tpaTypes.SET_SEARCH_DIMENSIONS, searchDimensions)\r\n      }))\r\n\r\n      let token  = parseCookie(req.headers.cookie, 'token')\r\n      let signin_ts  = parseCookie(req.headers.cookie, 'signin_ts')\r\n      console.log('token:', token, signin_ts)\r\n      if (token && signin_ts) {\r\n        await dispatch(`${uaPrefix}/signinByToken`, {token, signin_ts})\r\n      }\r\n\r\n    } catch (e) {\r\n      // console.error('Error on [nuxtServerInit] action.', e) // eslint-disable-line no-console\r\n    }\r\n  },\r\n  switchCity ({state, commit}, cityId) {\r\n    commit(indexTypes.SET_CITY, state._cities.find(c => c._id === cityId))\r\n    return Promise.resolve()\r\n  }\r\n}\r\n```\r\n\r\nfirst time invoke the log:\r\n\r\n>   nuxt:render Rendering url /login +27s\r\n> --------------------nuxtServerInit:\r\n> CORS:post->http://192.168.10.194:3003/apis/share/auth/apiToken\r\n> data:path=apps%2F99alive&username=aaaa\r\n\r\nit's ok\r\nthen when i use F5\r\n\r\n> --------------------nuxtServerInit:\r\n> CORS:post->http://192.168.10.194:3003/apis/share/auth/apiToken\r\n> data:path=apps%2F99alive&username=aaaa\r\n> CORS:post->http://192.168.10.194:3003/apis/share/auth/apiToken\r\n> data:\r\n> \r\nit seems invoke twice,and the second invoke with body empty\r\nnow, i refreshed by F5 agian and the log:\r\n\r\n> --------------------nuxtServerInit:\r\n> CORS:post->http://192.168.10.194:3003/apis/share/auth/apiToken\r\n> data:path=apps%2F99alive&username=aaaa\r\n> CORS:post->http://192.168.10.194:3003/apis/share/auth/apiToken\r\n> data:\r\n> CORS:post->http://192.168.10.194:3003/apis/share/auth/apiToken\r\n> data:\r\n> \r\nit invoke three times!!!\r\nwhat's going on\r\n@alexchopin @pi0 "}}
{"actor":{"display_login":"zppro"}}