mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 15:36:33 +00:00
fix(settings): the client registration form says what the server refused
Registering an OAuth client by hand and getting only "Failed to register OAuth client" left nothing to act on: the server names the rule it broke (a scope, the ten-client cap, a redirect URI it will not take) and the toast swallowed it in a bare catch. Both shells show the server's message now and keep the generic text for a failure that carries none.
This commit is contained in:
@@ -13,6 +13,7 @@ import ApiKeysSection from './ApiKeysSection'
|
||||
import { PRESET_SCOPES_DEFAULT, PRESET_SCOPES_READONLY } from '../../api/oauthScopes'
|
||||
import ScopeGroupPicker from '../OAuth/ScopeGroupPicker'
|
||||
import { useAuthStore } from '../../store/authStore'
|
||||
import { getApiErrorMessage } from '../../utils/apiError'
|
||||
|
||||
interface OAuthPreset {
|
||||
id: string
|
||||
@@ -266,8 +267,11 @@ function useIntegrations() {
|
||||
setOauthNewUris('')
|
||||
setOauthNewScopes([])
|
||||
setOauthIsMachine(false)
|
||||
} catch {
|
||||
toast.error(t('settings.oauth.toast.createError'))
|
||||
} catch (err) {
|
||||
// The server names the rule that refused the client (a scope, the
|
||||
// ten-client cap, a redirect URI it will not take); swallowing it left
|
||||
// "Failed to register OAuth client" and nothing to act on.
|
||||
toast.error(getApiErrorMessage(err, t('settings.oauth.toast.createError')))
|
||||
} finally {
|
||||
setOauthCreating(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user