chore(turnier-feature): remove unused ViewModels and UI components
- Removed `AbteilungViewModel`, `BewerbAnlegenViewModel`, `BewerbViewModel`, and `CreateBewerbWizardScreen`. - Cleaned up related imports and unused domain models.
This commit is contained in:
@@ -10,13 +10,11 @@ version = "1.0.0"
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js {
|
||||
binaries.library()
|
||||
browser {
|
||||
testTask {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
js(IR) {
|
||||
browser()
|
||||
}
|
||||
wasmJs {
|
||||
browser()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -63,6 +61,11 @@ kotlin {
|
||||
implementation(libs.ktor.client.cio)
|
||||
}
|
||||
|
||||
wasmJsMain.dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-wasm-js:2.3.20")
|
||||
implementation(libs.ktor.client.js)
|
||||
}
|
||||
|
||||
jsMain.dependencies {
|
||||
implementation(libs.ktor.client.js)
|
||||
}
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package at.mocode.frontend.core.auth.data
|
||||
|
||||
/**
|
||||
* Wasm-Implementierung für OIDC Redirect.
|
||||
*/
|
||||
actual suspend fun launchOidcFlow(
|
||||
authUrl: String,
|
||||
callbackPort: Int
|
||||
): OidcCallbackResult {
|
||||
setWindowLocationHref(authUrl)
|
||||
return OidcCallbackResult.Redirecting
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun setWindowLocationHref(url: String): Unit = js("window.location.href = url")
|
||||
|
||||
/**
|
||||
* Prüft auf OIDC Callback-Parameter in der URL.
|
||||
*/
|
||||
actual fun consumePendingOidcCallback(): OidcCallbackResult? {
|
||||
val search: String = getWindowLocationSearch()
|
||||
if (!search.contains("code=")) return null
|
||||
|
||||
val query = search.removePrefix("?")
|
||||
val params = parseQueryParams(query)
|
||||
|
||||
val code = params["code"] ?: return null
|
||||
val state = params["state"] ?: return null
|
||||
val error = params["error"]
|
||||
|
||||
try {
|
||||
replaceWindowState(getWindowLocationPathname())
|
||||
} catch (_: Throwable) {}
|
||||
|
||||
return if (error != null) {
|
||||
OidcCallbackResult.Error(
|
||||
error = error,
|
||||
description = params["error_description"]
|
||||
)
|
||||
} else {
|
||||
OidcCallbackResult.Success(code = code, state = state)
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun getWindowLocationSearch(): String = js("window.location.search")
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun getWindowLocationPathname(): String = js("window.location.pathname")
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun replaceWindowState(path: String): Unit = js("window.history.replaceState(null, '', path)")
|
||||
|
||||
private fun parseQueryParams(query: String): Map<String, String> =
|
||||
query.split("&")
|
||||
.filter { it.contains("=") }
|
||||
.associate {
|
||||
val parts = it.split("=", limit = 2)
|
||||
val key = parts[0]
|
||||
val value = decodeURIComponent(parts.getOrElse(1) { "" })
|
||||
key to value
|
||||
}
|
||||
|
||||
actual fun getOidcRedirectUri(): String {
|
||||
val origin: String = try {
|
||||
getWindowLocationOrigin()
|
||||
} catch (_: Throwable) {
|
||||
"http://localhost"
|
||||
}
|
||||
return origin + at.mocode.frontend.core.domain.AppConstants.OIDC_REDIRECT_URI_JS_PATH
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun getWindowLocationOrigin(): String = js("window.location.origin")
|
||||
|
||||
@OptIn(ExperimentalWasmJsInterop::class)
|
||||
private fun decodeURIComponent(encoded: String): String =
|
||||
js("decodeURIComponent(encoded)")
|
||||
Reference in New Issue
Block a user