refactor: remove unnecessary return await (#2224)

* refactor: remove unnecessary return await

* refactor: remove unnecessary async
This commit is contained in:
Clark Du 2017-11-24 16:33:47 +08:00 committed by Pooya Parsa
parent 7a301bed6c
commit 16c12d1e85
2 changed files with 8 additions and 8 deletions

View File

@ -76,9 +76,9 @@ export default async ssrContext => {
await beforeRender() await beforeRender()
return _app return _app
} }
const render404Page = async () => { const render404Page = () => {
app.context.error({ statusCode: 404, message: '<%= messages.error_404 %>' }) app.context.error({ statusCode: 404, message: '<%= messages.error_404 %>' })
return await renderErrorPage() return renderErrorPage()
} }
<% if (isDev) { %>const s = isDev && Date.now()<% } %> <% if (isDev) { %>const s = isDev && Date.now()<% } %>
@ -100,7 +100,7 @@ export default async ssrContext => {
} }
// ...If there is a redirect or an error, stop the process // ...If there is a redirect or an error, stop the process
if (ssrContext.redirected) return noopApp() if (ssrContext.redirected) return noopApp()
if (ssrContext.nuxt.error) return await renderErrorPage() if (ssrContext.nuxt.error) return renderErrorPage()
<% } %> <% } %>
/* /*
@ -117,7 +117,7 @@ export default async ssrContext => {
await middlewareSeries(midd, app.context) await middlewareSeries(midd, app.context)
// ...If there is a redirect or an error, stop the process // ...If there is a redirect or an error, stop the process
if (ssrContext.redirected) return noopApp() if (ssrContext.redirected) return noopApp()
if (ssrContext.nuxt.error) return await renderErrorPage() if (ssrContext.nuxt.error) return renderErrorPage()
/* /*
** Set layout ** Set layout
@ -149,7 +149,7 @@ export default async ssrContext => {
await middlewareSeries(midd, app.context) await middlewareSeries(midd, app.context)
// ...If there is a redirect or an error, stop the process // ...If there is a redirect or an error, stop the process
if (ssrContext.redirected) return noopApp() if (ssrContext.redirected) return noopApp()
if (ssrContext.nuxt.error) return await renderErrorPage() if (ssrContext.nuxt.error) return renderErrorPage()
/* /*
** Call .validate() ** Call .validate()
@ -210,7 +210,7 @@ export default async ssrContext => {
// ...If there is a redirect or an error, stop the process // ...If there is a redirect or an error, stop the process
if (ssrContext.redirected) return noopApp() if (ssrContext.redirected) return noopApp()
if (ssrContext.nuxt.error) return await renderErrorPage() if (ssrContext.nuxt.error) return renderErrorPage()
// Call beforeNuxtRender methods & add store state // Call beforeNuxtRender methods & add store state
await beforeRender() await beforeRender()

View File

@ -73,8 +73,8 @@ export function flatMapComponents(route, fn) {
})) }))
} }
export async function resolveRouteComponents(route) { export function resolveRouteComponents(route) {
return await Promise.all( return Promise.all(
flatMapComponents(route, async (Component, _, match, key) => { flatMapComponents(route, async (Component, _, match, key) => {
// If component is a function, resolve it // If component is a function, resolve it
if (typeof Component === 'function' && !Component.options) { if (typeof Component === 'function' && !Component.options) {