mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
any/type assertion fixes (#57009)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import useAsyncFn from 'react-use/lib/useAsyncFn';
|
||||
|
||||
import { getBackendSrv } from '@grafana/runtime';
|
||||
import { getBackendSrv, isFetchError } from '@grafana/runtime';
|
||||
import { LinkButton } from '@grafana/ui';
|
||||
import { Page } from 'app/core/components/Page/Page';
|
||||
import { contextSrv } from 'app/core/services/context_srv';
|
||||
@@ -17,8 +17,8 @@ const getOrgs = async () => {
|
||||
return await getBackendSrv().get('/api/orgs');
|
||||
};
|
||||
|
||||
const getErrorMessage = (error: any) => {
|
||||
return error?.data?.message || 'An unexpected error happened.';
|
||||
const getErrorMessage = (error: Error) => {
|
||||
return isFetchError(error) ? error?.data?.message : 'An unexpected error happened.';
|
||||
};
|
||||
|
||||
export default function AdminListOrgsPages() {
|
||||
|
||||
@@ -7,10 +7,7 @@ import { Page } from 'app/core/components/Page/Page';
|
||||
type Settings = { [key: string]: { [key: string]: string } };
|
||||
|
||||
function AdminSettings() {
|
||||
const { loading, value: settings } = useAsync(
|
||||
() => getBackendSrv().get('/api/admin/settings') as Promise<Settings>,
|
||||
[]
|
||||
);
|
||||
const { loading, value: settings } = useAsync(() => getBackendSrv().get<Settings>('/api/admin/settings'), []);
|
||||
|
||||
return (
|
||||
<Page navId="server-settings">
|
||||
|
||||
@@ -24,7 +24,7 @@ import { changeFilter, changePage, changeQuery, fetchUsers } from './state/actio
|
||||
|
||||
export interface FilterProps {
|
||||
filters: UserFilter[];
|
||||
onChange: (filter: any) => void;
|
||||
onChange: (filter: UserFilter) => void;
|
||||
className?: string;
|
||||
}
|
||||
const extraFilters: Array<ComponentType<FilterProps>> = [];
|
||||
|
||||
Reference in New Issue
Block a user