Fix type-aware lint errors on OAuth tokens page
The linter's project service ignores the generated Relay artifacts, so the untyped usePreloadedQuery call left viewer as an error type and triggered no-unsafe-argument/member-access errors. Pass the explicit query generic like the sibling audit-log page does. Drop the redundant GraphQLError cast on the revoke error handler since formatError already accepts the callback's error type. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -85,7 +85,10 @@ export function OAuthTokensPage(props: {
|
|||||||
|
|
||||||
usePageTitle(__("OAuth tokens"));
|
usePageTitle(__("OAuth tokens"));
|
||||||
|
|
||||||
const { viewer } = usePreloadedQuery(oauthTokensPageQuery, queryRef);
|
const { viewer } = usePreloadedQuery<OAuthTokensPageQuery>(
|
||||||
|
oauthTokensPageQuery,
|
||||||
|
queryRef,
|
||||||
|
);
|
||||||
const { data, loadNext, hasNext, isLoadingNext } = usePaginationFragment<
|
const { data, loadNext, hasNext, isLoadingNext } = usePaginationFragment<
|
||||||
OAuthTokensPageRefetchQuery,
|
OAuthTokensPageRefetchQuery,
|
||||||
OAuthTokensPageFragment$key
|
OAuthTokensPageFragment$key
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
// PERFORMANCE OF THIS SOFTWARE.
|
// PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
import { formatError, type GraphQLError } from "@probo/helpers";
|
import { formatError } from "@probo/helpers";
|
||||||
import { useTranslate } from "@probo/i18n";
|
import { useTranslate } from "@probo/i18n";
|
||||||
import {
|
import {
|
||||||
Badge,
|
Badge,
|
||||||
@@ -87,7 +87,7 @@ export function OAuthTokenRow(props: {
|
|||||||
title: __("Error"),
|
title: __("Error"),
|
||||||
description: formatError(
|
description: formatError(
|
||||||
__("Failed to revoke OAuth token."),
|
__("Failed to revoke OAuth token."),
|
||||||
errors as GraphQLError[],
|
errors,
|
||||||
),
|
),
|
||||||
variant: "error",
|
variant: "error",
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user