Skip to content

Commit 75a6781

Browse files
fix(settings): Restore useState import and type onError param
The previous commit accidentally removed the useState import still needed for permissions state. Also explicitly type the onError parameter as RequestError since handleXhrErrorResponse requires it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 577d6c4 commit 75a6781

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

static/app/views/settings/account/apiNewToken.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {useCallback} from 'react';
1+
import {useCallback, useState} from 'react';
22
import {z} from 'zod';
33

44
import {Button} from '@sentry/scraps/button';
@@ -26,6 +26,7 @@ import type {NewInternalAppApiToken} from 'sentry/types/user';
2626
import {getApiUrl} from 'sentry/utils/api/getApiUrl';
2727
import {handleXhrErrorResponse} from 'sentry/utils/handleXhrErrorResponse';
2828
import {fetchMutation, useMutation, useQueryClient} from 'sentry/utils/queryClient';
29+
import type {RequestError} from 'sentry/utils/requestError/requestError';
2930
import {normalizeUrl} from 'sentry/utils/url/normalizeUrl';
3031
import {useNavigate} from 'sentry/utils/useNavigate';
3132
import {displayNewToken} from 'sentry/views/settings/components/newTokenHandler';
@@ -96,7 +97,7 @@ export default function ApiNewToken() {
9697
queryClient.invalidateQueries({queryKey: [getApiUrl('/api-tokens/')]});
9798
displayNewToken(token.token, handleGoBack);
9899
},
99-
onError: error => {
100+
onError: (error: RequestError) => {
100101
const message = t('Failed to create a new personal token.');
101102
handleXhrErrorResponse(message, error);
102103
addErrorMessage(message);

static/app/views/settings/account/apiTokenDetails.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
useMutation,
2828
useQueryClient,
2929
} from 'sentry/utils/queryClient';
30+
import type {RequestError} from 'sentry/utils/requestError/requestError';
3031
import {normalizeUrl} from 'sentry/utils/url/normalizeUrl';
3132
import {useNavigate} from 'sentry/utils/useNavigate';
3233
import {useParams} from 'sentry/utils/useParams';
@@ -99,7 +100,7 @@ function ApiTokenDetailsForm({token}: {token: InternalAppApiToken}) {
99100

100101
handleGoBack();
101102
},
102-
onError: error => {
103+
onError: (error: RequestError) => {
103104
const message = t('Failed to update the user auth token.');
104105
handleXhrErrorResponse(message, error);
105106
addErrorMessage(message);

0 commit comments

Comments
 (0)