@@ -70,8 +70,8 @@ export default class Router extends String {
7070 */
7171 current ( name , params ) {
7272 const url = this . _config . absolute
73- ? this . _location . host + this . _location . pathname
74- : this . _location . pathname . replace ( this . _config . url . replace ( / ^ \w * : \/ \/ [ ^ / ] + / , '' ) , '' ) . replace ( / ^ \/ + / , '/' ) ;
73+ ? this . _location ( ) . host + this . _location ( ) . pathname
74+ : this . _location ( ) . pathname . replace ( this . _config . url . replace ( / ^ \w * : \/ \/ [ ^ / ] + / , '' ) , '' ) . replace ( / ^ \/ + / , '/' ) ;
7575
7676 // Find the first route that matches the current URL
7777 const [ current , route ] = Object . entries ( this . _config . routes ) . find (
@@ -106,7 +106,7 @@ export default class Router extends String {
106106 *
107107 * @return {Object }
108108 */
109- get _location ( ) {
109+ _location ( ) {
110110 const { host = '' , pathname = '' , search = '' } = typeof window !== 'undefined' ? window . location : { } ;
111111
112112 return {
@@ -239,7 +239,7 @@ export default class Router extends String {
239239 * @return {Object } Parameters.
240240 */
241241 _dehydrate ( route ) {
242- let pathname = this . _location . pathname
242+ let pathname = this . _location ( ) . pathname
243243 // If this Laravel app is in a subdirectory, trim the subdirectory from the path
244244 . replace ( this . _config . url . replace ( / ^ \w * : \/ \/ [ ^ / ] + / , '' ) , '' )
245245 . replace ( / ^ \/ + / , '' ) ;
@@ -260,9 +260,9 @@ export default class Router extends String {
260260 }
261261
262262 return {
263- ...dehydrate ( this . _location . host , route . domain , '.' ) , // Domain parameters
263+ ...dehydrate ( this . _location ( ) . host , route . domain , '.' ) , // Domain parameters
264264 ...dehydrate ( pathname , route . uri , '/' ) , // Path parameters
265- ...parse ( this . _location . search ?. replace ( / ^ \? / , '' ) ) , // Query parameters
265+ ...parse ( this . _location ( ) . search ?. replace ( / ^ \? / , '' ) ) , // Query parameters
266266 } ;
267267 }
268268
0 commit comments