{"action":"created","issue":{"url":"https://api.github.com/repos/nuxt/nuxt.js/issues/2119","repository_url":"https://api.github.com/repos/nuxt/nuxt.js","labels_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/2119/labels{/name}","comments_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/2119/comments","events_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/2119/events","html_url":"https://github.com/nuxt/nuxt.js/issues/2119","id":274175624,"number":2119,"title":"How can I make sure that the data that has just loaded into LocalStorage can be used immediately in the code?","user":{"login":"Jussiadev","id":26526753,"avatar_url":"https://avatars0.githubusercontent.com/u/26526753?v=4","gravatar_id":"","url":"https://api.github.com/users/Jussiadev","html_url":"https://github.com/Jussiadev","followers_url":"https://api.github.com/users/Jussiadev/followers","following_url":"https://api.github.com/users/Jussiadev/following{/other_user}","gists_url":"https://api.github.com/users/Jussiadev/gists{/gist_id}","starred_url":"https://api.github.com/users/Jussiadev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jussiadev/subscriptions","organizations_url":"https://api.github.com/users/Jussiadev/orgs","repos_url":"https://api.github.com/users/Jussiadev/repos","events_url":"https://api.github.com/users/Jussiadev/events{/privacy}","received_events_url":"https://api.github.com/users/Jussiadev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-11-15T14:29:11Z","updated_at":"2017-11-15T20:37:51Z","closed_at":null,"author_association":"NONE","body":"I have requests on the site for the API, one of the parameters for the query is `town_id`.\r\nAnd the value that we substitute there is taken from `LocalStorage`\r\n`town_id: JSON.parse (localStorage.getItem ('town')). ​​id`,\r\nWe put it there, automatically determining the user's location and sending the required query to the API. As a result, we get such an object\r\n```{\r\n                        \"id\": 2379,\r\n                        \"name\": \"Moscow\",\r\n                        \"region\": \"Moscow region\",\r\n                        \"lat\": \"55.755814\",\r\n                        \"long\": \"37.617635\",\r\n                        \"update_at\": 1489006800\r\n                    };};\r\n```\r\nwhich we place in `LocalStorage`.\r\n\r\nHowever, if you clear the `LocalStorage` and reload the page, then\r\n`console.log ((JSON.parse (localStorage.getItem ('town')))));`\r\nreturns `null`. And therefore there is nothing to lay in the `town_id`.\r\nMore details on the [video.](https://www.dropbox.com/s/mzek869z13kbrea/ice_video_20171114-174602.mp4?dl=0)"},"comment":{"url":"https://api.github.com/repos/nuxt/nuxt.js/issues/comments/344720757","html_url":"https://github.com/nuxt/nuxt.js/issues/2119#issuecomment-344720757","issue_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/2119","id":344720757,"user":{"login":"uptownhr","id":1021110,"avatar_url":"https://avatars2.githubusercontent.com/u/1021110?v=4","gravatar_id":"","url":"https://api.github.com/users/uptownhr","html_url":"https://github.com/uptownhr","followers_url":"https://api.github.com/users/uptownhr/followers","following_url":"https://api.github.com/users/uptownhr/following{/other_user}","gists_url":"https://api.github.com/users/uptownhr/gists{/gist_id}","starred_url":"https://api.github.com/users/uptownhr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uptownhr/subscriptions","organizations_url":"https://api.github.com/users/uptownhr/orgs","repos_url":"https://api.github.com/users/uptownhr/repos","events_url":"https://api.github.com/users/uptownhr/events{/privacy}","received_events_url":"https://api.github.com/users/uptownhr/received_events","type":"User","site_admin":false},"created_at":"2017-11-15T20:37:51Z","updated_at":"2017-11-15T20:37:51Z","author_association":"CONTRIBUTOR","body":"@Jussiadev I think i need to see how getItem('town') is being used.. "}}
{"actor":{"display_login":"uptownhr"}}