Skip to content

Instantly share code, notes, and snippets.

@vladimirlukyanov
Last active April 23, 2018 07:23
Show Gist options
  • Select an option

  • Save vladimirlukyanov/7eede6db3799cfcc93575253e82a0ecd to your computer and use it in GitHub Desktop.

Select an option

Save vladimirlukyanov/7eede6db3799cfcc93575253e82a0ecd to your computer and use it in GitHub Desktop.

Revisions

  1. Vladimir Lukyanov revised this gist Apr 23, 2018. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion nuxt.config.js
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,6 @@ export default {
    plugins: [],
    build: {
    analyze: false,
    watch: ['api']
    },

    loading: {color: '#41B883'},
  2. Vladimir Lukyanov revised this gist Apr 23, 2018. No changes.
  3. Vladimir Lukyanov revised this gist Apr 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 404-redirect.js
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    export default function ({params, route, redirect}) {

    if(route.matched.length === 0) {
    if(route.matched.length === 0) { // route is not found, redirect to homepage
    redirect('302', '/');
    }

  4. Vladimir Lukyanov revised this gist Apr 23, 2018. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions 404-redirect.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    // Add this file to /middleware

    export default function ({params, route, redirect}) {

    if(route.matched.length === 0) {
    redirect('302', '/');
    }

    }
  5. Vladimir Lukyanov revised this gist Apr 23, 2018. 1 changed file with 0 additions and 9 deletions.
    9 changes: 0 additions & 9 deletions nuxt.config.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,3 @@
    import bodyParser from 'body-parser'
    import morgan from 'morgan'
    import session from 'express-session'

    export default {
    head: {
    title: 'Auth Routes',
    @@ -11,11 +7,6 @@ export default {
    {hid: 'description', content: 'Auth Routes example'}
    ]
    },
    css: [
    '~assets/css/bootstrap.min.css',
    '~assets/css/app.css',
    '~assets/css/font-awesome.min.css',
    ],

    plugins: [],
    build: {
  6. Vladimir Lukyanov created this gist Apr 23, 2018.
    32 changes: 32 additions & 0 deletions nuxt.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    import bodyParser from 'body-parser'
    import morgan from 'morgan'
    import session from 'express-session'

    export default {
    head: {
    title: 'Auth Routes',
    meta: [
    {charset: 'utf-8'},
    {name: 'viewport', content: 'width=device-width, initial-scale=1'},
    {hid: 'description', content: 'Auth Routes example'}
    ]
    },
    css: [
    '~assets/css/bootstrap.min.css',
    '~assets/css/app.css',
    '~assets/css/font-awesome.min.css',
    ],

    plugins: [],
    build: {
    analyze: false,
    watch: ['api']
    },

    loading: {color: '#41B883'},

    router: {
    linkActiveClass: 'active',
    middleware: ['404-redirect'] // important to add
    }
    }