File tree 4 files changed +30
-11
lines changed
4 files changed +30
-11
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ in upstream
99
99
-------------------------------
100
100
-}
101
101
let upstream =
102
- https:// github. com/ purescript/ package- sets/ releases/ download/ psc- 0.15 . 4 - 20220822 / packages. dhall
103
- sha256: 908 b4ffbfba37a0a4edf806513a555d0dbcdd0cde7abd621f8d018d2e8ecf828
102
+ https:// github. com/ purescript/ package- sets/ releases/ download/ psc- 0.15 . 4 - 20230105 / packages. dhall
103
+ sha256: 3e9 fbc9ba03e9a1fcfd895f65e2d50ee2f5e86c4cd273f3d5c841b655a0e1bda
104
104
105
105
in upstream
Original file line number Diff line number Diff line change @@ -12,10 +12,12 @@ to generate this file without the comments in this block.
12
12
-}
13
13
{ name = " my-project"
14
14
, dependencies =
15
- [ " aff-promise"
15
+ [ " aff"
16
+ , " aff-promise"
16
17
, " console"
17
18
, " effect"
18
19
, " functions"
20
+ , " maybe"
19
21
, " nullable"
20
22
, " prelude"
21
23
, " react-basic"
Original file line number Diff line number Diff line change 1
- export { useRouter as useRouter_ } from ' next/router'
1
+ export { useRouter as useRouter_ } from " next/router" ;
2
2
import router from "next/router" ;
3
3
4
4
export function _on ( event ) {
5
- return function ( cb ) {
6
- return function ( ) {
5
+ return function ( cb ) {
6
+ return function ( ) {
7
7
router . events . on ( event , cb ) ;
8
8
} ;
9
9
} ;
10
10
}
11
11
12
12
export function _off ( event ) {
13
- return function ( cb ) {
14
- return function ( ) {
13
+ return function ( cb ) {
14
+ return function ( ) {
15
15
router . events . off ( event , cb ) ;
16
16
} ;
17
17
} ;
18
18
}
19
19
20
- export const query = ( router ) => router . query
20
+ export const query = ( router ) => router . query ;
21
21
22
- export const push = ( router ) => ( route ) => ( ) => router . push ( route )
22
+ export const push = ( router ) => ( route ) => ( ) => router . push ( route ) ;
23
23
24
- export const route = ( router ) => router . route
24
+ export const route = ( router ) => router . route ;
25
+
26
+ export const replaceImpl = ( router ) => ( route ) => ( as ) => ( options ) => ( ) =>
27
+ router . replace ( route , as , options ) ;
Original file line number Diff line number Diff line change 1
1
module Next.Router where
2
2
3
3
import Prelude
4
+
5
+ import Control.Promise (Promise )
6
+ import Control.Promise as Promise
7
+ import Data.Maybe (Maybe )
8
+ import Data.Nullable (Nullable )
9
+ import Data.Nullable as Nullable
4
10
import Effect (Effect )
11
+ import Effect.Aff (Aff )
5
12
import Effect.Uncurried (mkEffectFn1 )
6
13
import React.Basic.Hooks (Hook , unsafeHook )
7
14
@@ -18,6 +25,13 @@ foreign import query :: forall q. Router -> q
18
25
19
26
foreign import push :: Router -> String -> Effect Unit
20
27
28
+ type RoutingOptions = { shallow :: Boolean }
29
+
30
+ foreign import replaceImpl :: Router -> String -> Nullable String -> Nullable RoutingOptions -> Effect (Promise Boolean )
31
+
32
+ replace :: Router -> String -> Maybe String -> Maybe RoutingOptions -> Aff Boolean
33
+ replace router url asUrl options = replaceImpl router url (Nullable .toNullable asUrl) (Nullable .toNullable options) # Promise .toAffE
34
+
21
35
foreign import route :: Router -> String
22
36
23
37
foreign import _on :: forall a . String -> a -> Effect Unit
You can’t perform that action at this time.
0 commit comments