Skip to content

Commit

Permalink
Working correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
davesmith00000 committed May 26, 2023
1 parent dd426d5 commit 8773b74
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/routing/src/main/scala/example/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ object HelloTyrian extends TyrianApp[Msg, Model]:
case Msg.NavigateTo(page) =>
(model.copy(page = page), Nav.pushUrl(page.address))

case Msg.FollowInternalLink(page) =>
(model.copy(page = page), Cmd.None)

case Msg.FollowExternalLink(href) =>
(model, Nav.loadUrl(href))

Expand Down Expand Up @@ -117,7 +120,10 @@ enum Msg:
case Increment
case Decrement
case Reset
// Used by buttons, also triggers a pushState to update the address bar
case NavigateTo(page: Page)
// User by anchor tags, address bar automatically updated
case FollowInternalLink(page: Page)
case FollowExternalLink(href: String)

object CustomRoutes:
Expand Down Expand Up @@ -174,7 +180,7 @@ object CustomRoutes:
routeList = routes
)

Msg.NavigateTo(page)
Msg.FollowInternalLink(page)

case loc: Location.External =>
Msg.FollowExternalLink(loc.href)
Expand Down

0 comments on commit 8773b74

Please sign in to comment.