mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
fix(generator): handle when no routes.json
defined (#8166)
This commit is contained in:
parent
dfaa1960f7
commit
34f32113b4
@ -48,7 +48,7 @@ export default {
|
||||
watch: {
|
||||
async '$route.query.page' (page) {
|
||||
this.$nuxt.$loading.start()
|
||||
const { data } = await axios.get(`https://reqres.in/api/users?page=${page}`)
|
||||
const data = await fetch(`https://reqres.in/api/users?page=${page}`).then(res => res.json())
|
||||
this.users = data.data
|
||||
this.transitionName = this.getTransitionName(page)
|
||||
this.page = +(page || 1)
|
||||
|
@ -104,7 +104,13 @@ export default class Generator {
|
||||
if (this.options.router.mode === 'hash') {
|
||||
routes = ['/']
|
||||
} else {
|
||||
try {
|
||||
routes = flatRoutes(this.getAppRoutes())
|
||||
} catch (err) {
|
||||
// Case: where we use custom router.js
|
||||
// https://github.com/nuxt-community/router-module/issues/83
|
||||
routes = ['/']
|
||||
}
|
||||
}
|
||||
routes = routes.filter(route => this.shouldGenerateRoute(route))
|
||||
routes = this.decorateWithPayloads(routes, generateRoutes)
|
||||
|
Loading…
Reference in New Issue
Block a user