diff options
author | Joffrey Bion <joffrey.bion@gmail.com> | 2021-09-08 08:57:14 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@gmail.com> | 2021-09-08 08:57:20 +0200 |
commit | 97116a39f10ec0667b6a582e460600b2bcf992c1 (patch) | |
tree | 275952f9b932df532bc05d38217ec635d15f29fe | |
parent | Opt-in delicate GlobalScope in UI root (diff) | |
download | seven-wonders-97116a39f10ec0667b6a582e460600b2bcf992c1.tar.gz seven-wonders-97116a39f10ec0667b6a582e460600b2bcf992c1.tar.bz2 seven-wonders-97116a39f10ec0667b6a582e460600b2bcf992c1.zip |
Remove usages of deprecated route extensions
-rw-r--r-- | sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/Application.kt | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/Application.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/Application.kt index 9850f8c0..385abb18 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/Application.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/Application.kt @@ -9,13 +9,26 @@ import org.luxons.sevenwonders.ui.router.Route import react.RBuilder import react.router.dom.* -fun RBuilder.application() = hashRouter { +fun RBuilder.application() = HashRouter { errorDialog() - switch { + Switch { route(Route.GAME_BROWSER.path) { gameBrowser() } route(Route.GAME.path) { gameScene() } route(Route.LOBBY.path) { lobby() } route(Route.HOME.path, exact = true) { home() } - redirect(from = "*", to = "/") + Redirect { + attrs { + from = "*" + to = "/" + } + } + } +} + +private fun RBuilder.route(path: String, exact: Boolean = false, render: RBuilder.() -> Unit) { + Route { + attrs.path = arrayOf(path) + attrs.exact = exact + render() } } |