Skip to content

Commit ea4d4c3

Browse files
committed
Fix core config
1 parent cfcca6c commit ea4d4c3

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@westacks/vortex",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"license": "MIT",
55
"description": "Server-based routing for SPAs",
66
"author": "Dmytro Morozov <puny.flash@gmail.com>",

src/extensions/core.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import { getPage as page, setPage } from "../page";
22
import type { VortexExtension, VortexConfig } from "../index";
33

4+
const defaultConfig = {
5+
detect: 'x-vortex',
6+
version: 'x-vortex-version',
7+
component: 'x-vortex-component',
8+
location: 'x-vortex-location',
9+
only: 'x-vortex-only',
10+
}
11+
412
type CoreConfig = {
513
detect?: string
614
version?: string
@@ -9,13 +17,7 @@ type CoreConfig = {
917
only?: string
1018
}
1119

12-
const core = ({
13-
detect = 'x-vortex',
14-
version = 'x-vortex-version',
15-
component = 'x-vortex-component',
16-
location = 'x-vortex-location',
17-
only = 'x-vortex-only',
18-
}: CoreConfig): VortexExtension => ({ request, response }) => ({
20+
const core = ({detect = defaultConfig.detect, version = defaultConfig.version, component = defaultConfig.component, location = defaultConfig.location, only = defaultConfig.only}: CoreConfig = {}): VortexExtension => ({ request, response }) => ({
1921
request: request.use(function (request) {
2022
if (!request.vortex) {
2123
return request

0 commit comments

Comments
 (0)