Skip to content

Commit

Permalink
fix(nuxt-module): optional chaining to hasPrefixPath
Browse files Browse the repository at this point in the history
  • Loading branch information
mmeester authored Dec 7, 2021
1 parent a06046d commit f2a9903
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/nuxt-module/plugins/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default async ({ app, route, req }, inject) => {
* The nuxt-router always picks the first route that matches the new path, so for these pages the
* domainConfig attached to the route doesn't have to be the right one.
*/
if (!hasPrefixPath(domainConfig)) {
if (domainConfig && !hasPrefixPath(domainConfig)) {
if (process.client) {
// During client-side navigation the domain config can be manually loaded through the location origin.
const currentOrigin = location.origin;
Expand All @@ -176,7 +176,7 @@ export default async ({ app, route, req }, inject) => {
/* Same cause as in the above block:
* the fromDomainConfig has to be determined separately for routes with a domainConfig without prefixPath
*/
if (!hasPrefixPath(fromDomainConfig)) {
if (fromDomainConfig && !hasPrefixPath(fromDomainConfig)) {
if (process.client) {
// During client-side navigation the domain config can be manually loaded through the location origin,
// because the origin is still the same
Expand Down

0 comments on commit f2a9903

Please sign in to comment.