chore: error message is displayed to user in the error page (#1085)

This commit is contained in:
palash-signoz 2022-05-05 11:12:42 +05:30 committed by GitHub
parent fe18e85e36
commit 7cf567792a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,10 @@
import { Table, Typography } from 'antd';
import { notification, Table, Typography } from 'antd';
import { ColumnsType } from 'antd/lib/table';
import getAll from 'api/errors/getAll';
import ROUTES from 'constants/routes';
import dayjs from 'dayjs';
import React from 'react';
import React, { useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useQuery } from 'react-query';
import { useSelector } from 'react-redux';
import { generatePath, Link } from 'react-router-dom';
@ -16,6 +17,8 @@ function AllErrors(): JSX.Element {
(state) => state.globalTime,
);
const { t } = useTranslation(['common']);
const { isLoading, data } = useQuery(['getAllError', [maxTime, minTime]], {
queryFn: () =>
getAll({
@ -24,6 +27,14 @@ function AllErrors(): JSX.Element {
}),
});
useEffect(() => {
if (data?.error) {
notification.error({
message: data.error || t('something_went_wrong'),
});
}
}, [data?.error, data?.payload, t]);
const getDateValue = (value: string): JSX.Element => {
return (
<Typography>{dayjs(value).format('DD/MM/YYYY HH:mm:ss A')}</Typography>