Skip to content

Commit 7c3f397

Browse files
committed
refactor: 重构为服务端组件优先
1 parent 214bb62 commit 7c3f397

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "next-flow-interface",
3-
"version": "0.17.6",
3+
"version": "0.17.8",
44
"description": "Interface package for NEXT FlOW. You can use this package to build your own plugin that can control anything.",
55
"type": "module",
66
"module": "dist/index.js",

src/utils/page-utils.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,15 @@ export function getPageTypeBySpaceText(space: string): PageType {
1313
return PageType.VIEWER
1414
}
1515

16-
export function forceGetSearchParams(key: string, errorMessage = '') {
17-
const params = new URLSearchParams(window.location.search),
18-
mt = params.get(key)
19-
if (!mt) {
20-
if (errorMessage) {
21-
console.error(errorMessage, mt)
22-
}
23-
window.location.href = '/not-found'
24-
return ''
25-
}
26-
return mt
16+
export function getSearchParams(key: string) {
17+
const params = new URLSearchParams(window.location.search)
18+
return params.get(key) ?? undefined
2719
}
2820

2921
// Create a namespace object for backward compatibility
3022
const PageUtils = {
3123
getPageTypeBySpaceText,
32-
forceGetSearchParams,
24+
getSearchParams,
3325
}
3426

3527
export default PageUtils

0 commit comments

Comments
 (0)