Skip to content

Commit

Permalink
path routing
Browse files Browse the repository at this point in the history
  • Loading branch information
vaaaaanquish committed Jun 21, 2024
1 parent db5007a commit 5f8d90c
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions torisetsu/src/jsMain/kotlin/core/ComposeQuiz.kt
Original file line number Diff line number Diff line change
Expand Up @@ -266,23 +266,27 @@ class ComposeQuiz : Quiz {
),
)
private val results: List<String> = listOf(
"/torisetsu/aoitori.html",
"/torisetsu/swift_2.html",
"/torisetsu/swift_1.html",
"/torisetsu/penguin.html",
"/torisetsu/kakapo.html",
"/torisetsu/kanaria.html",
"/torisetsu/kiwi.html",
"/torisetsu/hayabusa.html",
"/torisetsu/hashibirokou.html",
"/torisetsu/hashibirokou_sr.html",
"/aoitori.html",
"/swift_2.html",
"/swift_1.html",
"/penguin.html",
"/kakapo.html",
"/kanaria.html",
"/kiwi.html",
"/hayabusa.html",
"/hashibirokou.html",
"/hashibirokou_sr.html",
)
override val currentQuizId: MutableState<Int> = mutableStateOf(0)
override val currentQuizNumber: MutableState<Int> = mutableStateOf(1)

override fun onClickNext(answerOption: AnswerOption) {
if (answerOption.isFinish) {
window.location.href = results[answerOption.nextId]
if (window.location.href.contains("torisetsu")) {
window.location.href = "/torisetsu" + results[answerOption.nextId]
} else {
window.location.href = results[answerOption.nextId]
}
}
currentQuizNumber.value += 1
currentQuizId.value = answerOption.nextId
Expand Down

0 comments on commit 5f8d90c

Please sign in to comment.