File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { store } from '@/store';
6
6
7
7
import { getIsLogin } from '../auth/authStore' ;
8
8
9
+ import { type LocationQueryRaw , stringifyQuery } from './query' ;
9
10
import { initAuthRoutes } from './routerHooks' ;
10
11
11
12
function initRouter ( ) {
@@ -88,13 +89,26 @@ export function navigator() {
88
89
reactRouter . navigate ( '/' ) ;
89
90
}
90
91
92
+ function push ( path : string , query ?: LocationQueryRaw , state ?: any ) {
93
+ let _path = path ;
94
+
95
+ if ( query ) {
96
+ const search = stringifyQuery ( query ) ;
97
+
98
+ _path = `${ path } ?${ search } ` ;
99
+ }
100
+
101
+ reactRouter . navigate ( _path , { state } ) ;
102
+ }
103
+
91
104
return {
92
105
back,
93
106
forward,
94
107
go,
95
108
goHome,
96
109
navigate,
97
110
navigateUp,
111
+ push,
98
112
reactRouter,
99
113
reload,
100
114
replace
You can’t perform that action at this time.
0 commit comments