import React, { FC } from 'react'; import { Alert, AlertDescription, AlertIcon, AlertTitle, Box, HStack, Spinner, } from '@chakra-ui/react'; import { useTranslation } from 'react-i18next'; import { Container, Heading, VStack } from '@chakra-ui/react'; import { useParams } from 'react-router-dom'; import { LandingThemeProvider, withLandingThemeProvider, } from '../../containers'; import { OrderDetails } from '../../components/order-view'; import { Order } from '../../models/landing'; import { landingApi } from '../../__data__/service/landing.api'; import { ErrorMessage } from '../../models/api'; const Page: FC = () => { const { t } = useTranslation('~', { keyPrefix: 'dry-wash.order-view', }); const { orderId } = useParams(); const { isLoading, isSuccess, data: order, isError, error, } = landingApi.useGetOrderQuery( { orderId, }, ); const errorMessage = error as ErrorMessage; return ( {t('title')} {isLoading ? ( ) : ( <> <> {isSuccess && ( )} <> {isError && ( {t('get-order-query.error.title')} {errorMessage} )} )} ); }; export default withLandingThemeProvider(Page);