diff options
| author | Paul-Christian Volkmer | 2024-05-06 11:42:11 +0200 |
|---|---|---|
| committer | Paul-Christian Volkmer | 2024-05-06 11:42:11 +0200 |
| commit | 94d7b4c4f052948dc0735c0ee683e4d4ce92f8dc (patch) | |
| tree | b9959a5ea78f43a5a18069350f765f2998db06c5 /src/main/kotlin/dev/dnpm | |
| parent | 107429fda7a4814d5fee5f374240df2352ebaad1 (diff) | |
test: add tests for token requests
Diffstat (limited to 'src/main/kotlin/dev/dnpm')
| -rw-r--r-- | src/main/kotlin/dev/dnpm/etl/processor/web/ConfigController.kt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/web/ConfigController.kt b/src/main/kotlin/dev/dnpm/etl/processor/web/ConfigController.kt index 36589c8..4e101eb 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/web/ConfigController.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/web/ConfigController.kt @@ -127,10 +127,11 @@ class ConfigController( } else { model.addAttribute("tokensEnabled", true) val result = tokenService.addToken(name) - if (result.isSuccess) { - model.addAttribute("newTokenValue", result.getOrDefault("")) + result.onSuccess { + model.addAttribute("newTokenValue", it) model.addAttribute("success", true) - } else { + } + result.onFailure { model.addAttribute("success", false) } model.addAttribute("tokens", tokenService.findAll()) |
