mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
refactor: use modernMode instead of isModernBrowser for more semantic
This commit is contained in:
parent
2a36dbad22
commit
64839313a9
@ -13,10 +13,10 @@ const isModernBrowser = (ua) => {
|
||||
|
||||
export default function (req, res, next) {
|
||||
const { socket = {}, headers } = req
|
||||
if (socket.isModernBrowser === undefined) {
|
||||
if (socket.modernMode === undefined) {
|
||||
const ua = headers && headers['user-agent']
|
||||
socket.isModernBrowser = isModernBrowser(ua)
|
||||
socket.modernMode = isModernBrowser(ua)
|
||||
}
|
||||
req.isModernBrowser = socket.isModernBrowser
|
||||
req.modernMode = socket.modernMode
|
||||
next()
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ export default class Server {
|
||||
// Add webpack middleware support only for development
|
||||
if (this.options.dev) {
|
||||
this.useMiddleware(async (req, res, next) => {
|
||||
const name = req.isModernBrowser ? 'modern' : 'client'
|
||||
const name = req.modernMode ? 'modern' : 'client'
|
||||
if (this.devMiddleware[name]) {
|
||||
await this.devMiddleware[name](req, res)
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ export default class VueRenderer {
|
||||
|
||||
let APP
|
||||
// Call renderToString from the bundleRenderer and generate the HTML (will update the context as well)
|
||||
if (req && req.isModernBrowser) {
|
||||
if (req && req.modernMode) {
|
||||
APP = await this.renderer.modern.renderToString(context)
|
||||
} else {
|
||||
APP = await this.renderer.ssr.renderToString(context)
|
||||
|
Loading…
Reference in New Issue
Block a user