feat: Implement account deletion feature with UI and API integration
Some checks failed
Deploy tt-tagebuch / deploy (push) Has been cancelled

This commit is contained in:
Torsten Schulz (local)
2026-05-18 14:12:14 +02:00
parent b9bbd45ae9
commit ecfd3bf851
13 changed files with 265 additions and 9 deletions

View File

@@ -1,9 +1,11 @@
package de.tsschulz.tt_tagebuch.shared.api
import de.tsschulz.tt_tagebuch.shared.api.http.AuthedHttpClient
import de.tsschulz.tt_tagebuch.shared.api.models.DeleteAccountRequest
import de.tsschulz.tt_tagebuch.shared.api.models.LoginRequest
import de.tsschulz.tt_tagebuch.shared.api.models.LoginResponse
import io.ktor.client.call.body
import io.ktor.client.request.delete
import io.ktor.client.request.post
import io.ktor.client.request.setBody
@@ -19,4 +21,10 @@ class AuthApi(
suspend fun logout() {
client.http.post("/api/auth/logout")
}
suspend fun deleteAccount(password: String) {
client.http.delete("/api/auth/account") {
setBody(DeleteAccountRequest(password = password))
}
}
}

View File

@@ -8,3 +8,8 @@ data class LoginRequest(
val password: String,
val rememberMe: Boolean = false,
)
@Serializable
data class DeleteAccountRequest(
val password: String,
)

View File

@@ -54,6 +54,11 @@ class AuthManager(
clearLocal()
}
suspend fun deleteAccount(password: String) {
authApi.deleteAccount(password)
clearLocal()
}
suspend fun clearLocal() {
tokenProvider.token = null
tokenProvider.username = null