Skip to content

Commit

Permalink
Just a test commit for investigation
Browse files Browse the repository at this point in the history
  • Loading branch information
orchestr7 committed Sep 8, 2024
1 parent 7090812 commit a9a7f87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.liquibase:liquibase-core")
implementation("com.h2database:h2:2.3.232")
implementation("com.mysql:mysql-connector-j:9.0.0")
implementation("commons-codec:commons-codec:1.17.1")
runtimeOnly("io.jsonwebtoken:jjwt-impl:0.11.5")
runtimeOnly("io.jsonwebtoken:jjwt-jackson:0.11.5")
Expand Down
17 changes: 13 additions & 4 deletions frontend/src/jsMain/kotlin/ru/posidata/views/main/Welcome.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import web.cssom.*

val welcomeCard = FC<WelcomeCardProps> { props ->
val getUser = useDeferredRequest {
console.log("running BE request")
if (props.tgUser != null) {
val response = get(
url = "${window.location.origin}/api/get",
Expand All @@ -36,22 +37,26 @@ val welcomeCard = FC<WelcomeCardProps> { props ->
)

when {
response.ok -> props.setUser(response.decodeFromJsonString<UserForSerializationDTO>())
response.ok -> {
console.log(response.decodeFromJsonString<UserForSerializationDTO>())
props.setUser(response.decodeFromJsonString<UserForSerializationDTO>())
}
else -> window.alert("Failed to login with telegram")
}
}
}

// just a small test
/*div {

div {
button {
onClick = {
console.log(props.tgUser)
getUser()
}
}
}
/*
div {
button {
onClick = {
Expand All @@ -68,7 +73,8 @@ val welcomeCard = FC<WelcomeCardProps> { props ->
}
}
}
*/
*/


div {
className = ClassName("row justify-content-center mt-1 px-0")
Expand Down Expand Up @@ -153,6 +159,8 @@ val welcomeCard = FC<WelcomeCardProps> { props ->
photoUrl = user.photo_url,
username = user.username,
)
console.log("successful redirect to TG")
console.log(feUser)
props.setTgUser(feUser)
}
}
Expand All @@ -177,6 +185,7 @@ val welcomeCard = FC<WelcomeCardProps> { props ->
cursor = "pointer".unsafeCast<Cursor>()
}
onClick = {
console.log("before user")
getUser()
props.setSelection(Selection.QUESTION)
}
Expand Down

0 comments on commit a9a7f87

Please sign in to comment.