Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/core/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export function fetchMixin(proto) {
}

proto._fetchFallbackPage = function (path, qs, cb = noop) {
const {requestHeaders, fallbackLanguages, loadSidebar} = this.config
const {requestHeaders, defaultFallbackLanguage, fallbackLanguages, loadSidebar} = this.config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the docs as well


if (!fallbackLanguages) {
return false
Expand All @@ -174,7 +174,14 @@ export function fetchMixin(proto) {
if (fallbackLanguages.indexOf(local) === -1) {
return false
}
const newPath = path.replace(new RegExp(`^/${local}`), '')

var defaultLanguage = '';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var defaultLanguage = '';
let defaultLanguage = '';

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var defaultLanguage = '';
var defaultLanguage = defaultFallbackLanguage ? defaultFallbackLanguage : '';

and remove the if stmt.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case you could convert this to a const and not a let as mentioned

if (defaultFallbackLanguage)
{
defaultLanguage = defaultFallbackLanguage;
}

const newPath = path.replace(new RegExp(`^/${local}`), defaultLanguage)
const req = request(newPath + qs, true, requestHeaders)

req.then(
Expand Down