{"action":"created","issue":{"url":"https://api.github.com/repos/nuxt/nuxt.js/issues/389","repository_url":"https://api.github.com/repos/nuxt/nuxt.js","labels_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/389/labels{/name}","comments_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/389/comments","events_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/389/events","html_url":"https://github.com/nuxt/nuxt.js/issues/389","id":214324011,"node_id":"MDU6SXNzdWUyMTQzMjQwMTE=","number":389,"title":"Layout not applied when middleware redirects to a page with different layout","user":{"login":"JiriChara","id":668763,"node_id":"MDQ6VXNlcjY2ODc2Mw==","avatar_url":"https://avatars0.githubusercontent.com/u/668763?v=4","gravatar_id":"","url":"https://api.github.com/users/JiriChara","html_url":"https://github.com/JiriChara","followers_url":"https://api.github.com/users/JiriChara/followers","following_url":"https://api.github.com/users/JiriChara/following{/other_user}","gists_url":"https://api.github.com/users/JiriChara/gists{/gist_id}","starred_url":"https://api.github.com/users/JiriChara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JiriChara/subscriptions","organizations_url":"https://api.github.com/users/JiriChara/orgs","repos_url":"https://api.github.com/users/JiriChara/repos","events_url":"https://api.github.com/users/JiriChara/events{/privacy}","received_events_url":"https://api.github.com/users/JiriChara/received_events","type":"User","site_admin":false},"labels":[{"id":550635112,"node_id":"MDU6TGFiZWw1NTA2MzUxMTI=","url":"https://api.github.com/repos/nuxt/nuxt.js/labels/status:%20available%20soon","name":"status: available soon","color":"6de8b0","default":false},{"id":469223663,"node_id":"MDU6TGFiZWw0NjkyMjM2NjM=","url":"https://api.github.com/repos/nuxt/nuxt.js/labels/type:%20bug","name":"type: bug","color":"ee0701","default":false}],"state":"closed","locked":false,"assignee":{"login":"Atinux","id":904724,"node_id":"MDQ6VXNlcjkwNDcyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/904724?v=4","gravatar_id":"","url":"https://api.github.com/users/Atinux","html_url":"https://github.com/Atinux","followers_url":"https://api.github.com/users/Atinux/followers","following_url":"https://api.github.com/users/Atinux/following{/other_user}","gists_url":"https://api.github.com/users/Atinux/gists{/gist_id}","starred_url":"https://api.github.com/users/Atinux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Atinux/subscriptions","organizations_url":"https://api.github.com/users/Atinux/orgs","repos_url":"https://api.github.com/users/Atinux/repos","events_url":"https://api.github.com/users/Atinux/events{/privacy}","received_events_url":"https://api.github.com/users/Atinux/received_events","type":"User","site_admin":false},"assignees":[{"login":"Atinux","id":904724,"node_id":"MDQ6VXNlcjkwNDcyNA==","avatar_url":"https://avatars2.githubusercontent.com/u/904724?v=4","gravatar_id":"","url":"https://api.github.com/users/Atinux","html_url":"https://github.com/Atinux","followers_url":"https://api.github.com/users/Atinux/followers","following_url":"https://api.github.com/users/Atinux/following{/other_user}","gists_url":"https://api.github.com/users/Atinux/gists{/gist_id}","starred_url":"https://api.github.com/users/Atinux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Atinux/subscriptions","organizations_url":"https://api.github.com/users/Atinux/orgs","repos_url":"https://api.github.com/users/Atinux/repos","events_url":"https://api.github.com/users/Atinux/events{/privacy}","received_events_url":"https://api.github.com/users/Atinux/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2017-03-15T09:04:19Z","updated_at":"2018-11-03T02:14:27Z","closed_at":"2017-03-24T18:09:16Z","author_association":"NONE","body":"Hi,\r\n\r\nI have an application with an authentication middleware that redirects user to a login page whenever she tries to access a restricted page. When I click on a link for a first time (from the default layout) then I am redirected to login page with a correct layout, but when I click on the link again (from the login layout), then I am redirected to login page with default layout applied, but it should use  login layout.\r\n\r\nSimplified version of `middleware/auth.js`:\r\n```js\r\nexport default function ({ route, redirect }) {\r\n  if (route.name === 'secret') {\r\n    redirect('/login');\r\n  }\r\n});\r\n```\r\n\r\n`layout/default.vue`:\r\n```vue\r\n<template>\r\n  <div>\r\n    <p>This is default layout</p>\r\n    <router-link to=\"secret\">Secret</router-link>\r\n  </div>\r\n</template>\r\n```\r\n\r\n`layout/login.vue`:\r\n```vue\r\n<template>\r\n  <div>\r\n    <p>This is login layout</p>\r\n    <router-link to=\"secret\">Secret</router-link>\r\n  </div>\r\n</template>\r\n```\r\n\r\n\r\n`pages/login.js`:\r\n```vue\r\n<template>\r\n  <div>This is login page</div>\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n    layout: 'login'\r\n  };\r\n</script>\r\n```\r\n\r\n`pages/secret.vue`:\r\n```vue\r\n<template>\r\n  <div>\r\n    <!-- uses default layout -->\r\n    <p>Secret</p>\r\n  </div>\r\n</template>\r\n```\r\n\r\n`pages/index.vue`:\r\n```vue\r\n<template>\r\n  <div>\r\n    <p>Index</p>\r\n  </div>\r\n</template>\r\n```\n\n<!--cmty--><!--cmty_prevent_hook-->\n<div align=\"right\"><sub><em>This bug report is available on <a href=\"https://nuxtjs.cmty.io\">Nuxt.js</a> community (<a href=\"https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c339\">#c339</a>)</em></sub></div>"},"comment":{"url":"https://api.github.com/repos/nuxt/nuxt.js/issues/comments/435552910","html_url":"https://github.com/nuxt/nuxt.js/issues/389#issuecomment-435552910","issue_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/389","id":435552910,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTU1MjkxMA==","user":{"login":"lock[bot]","id":33595554,"node_id":"MDM6Qm90MzM1OTU1NTQ=","avatar_url":"https://avatars1.githubusercontent.com/in/6672?v=4","gravatar_id":"","url":"https://api.github.com/users/lock%5Bbot%5D","html_url":"https://github.com/apps/lock","followers_url":"https://api.github.com/users/lock%5Bbot%5D/followers","following_url":"https://api.github.com/users/lock%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/lock%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/lock%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lock%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/lock%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/lock%5Bbot%5D/repos","events_url":"https://api.github.com/users/lock%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/lock%5Bbot%5D/received_events","type":"Bot","site_admin":false},"created_at":"2018-11-03T02:14:27Z","updated_at":"2018-11-03T02:14:27Z","author_association":"NONE","body":"This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.\n"}}
{"actor":{"display_login":"lock"}}