Skip to content

Commit

Permalink
デフォルトのトップページをconfigで設定できるよう追加
Browse files Browse the repository at this point in the history
  • Loading branch information
ienaga committed Nov 13, 2023
1 parent 0901961 commit 4314f07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@next2d/framework",
"description": "Next2D Framework is designed according to the principles of clean architecture, domain-driven development, test-driven development, and MVVM, with an emphasis on flexibility, scalability, and maintainability, and a design methodology that keeps each layer loosely coupled.",
"version": "2.0.1",
"version": "2.0.2",
"homepage": "https://next2d.app",
"bugs": "https://github.com/Next2D/Framework/issues/new",
"author": "Toshiyuki Ienaga <[email protected]> (https://github.com/ienaga/)",
Expand All @@ -27,8 +27,8 @@
},
"devDependencies": {
"@next2d/player": "*",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"eslint": "^8.53.0",
"jsdom": "^22.1.0",
"typescript": "^5.2.2",
Expand Down
9 changes: 5 additions & 4 deletions src/domain/parser/QueryParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,24 @@ export const execute = (name: string = ""): QueryObjectImpl =>
}
}

const defaultTop: string = config.defaultTop || "top";
if (!name) {
const names: string[] = location.pathname.split("/");
names.shift();
name = `${names.join("/")}`;
if (name && config && config.routing) {
const routing: RoutingImpl = config.routing[name];
if (!routing) {
name = "top";
name = defaultTop;
}

if (routing && routing.private) {
name = routing.redirect || "top";
name = routing.redirect || defaultTop;
}
}

if (!name) {
name = "top";
name = defaultTop;
}
}

Expand All @@ -75,7 +76,7 @@ export const execute = (name: string = ""): QueryObjectImpl =>
}

if (name.slice(0, 1) === ".") {
name = name.split("/").slice(1).join("/") || "top";
name = name.split("/").slice(1).join("/") || defaultTop;
}

if (name.indexOf("@") > -1) {
Expand Down

0 comments on commit 4314f07

Please sign in to comment.