Skip to content

Commit

Permalink
Merge pull request #47 from DVGY/feature/remove-types
Browse files Browse the repository at this point in the history
Feature/remove types
  • Loading branch information
DVGY authored Oct 21, 2023
2 parents fa46c81 + ff45f91 commit d6d528c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
10 changes: 7 additions & 3 deletions client/src/components/bookings/CheckoutForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,15 @@ const CheckoutForm: FC<ICheckoutForm> = ({ tripId, price }) => {
if (responsePaymentResult.error) {
setError(responsePaymentResult?.error);
}
setLoading(false);
} catch (error) {
setError(error);
setLoading(false);
if (error instanceof Error) {
console.log(error);
} else {
setError(error as unknown as StripeError);
}
console.log(error);
} finally {
setLoading(false);
}
};

Expand Down
1 change: 0 additions & 1 deletion client/src/components/trips/FilterTrips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ const FilterTrips: FC<IFilterTripsProps> = ({
size='xs'
rightIcon={<ChevronDownIcon />}
fontSize={['xs', 'xs', 'xs', 'md', 'md', 'md']}
isFullWidth='true'
textAlign='start'
fontWeight='medium'
>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/trips/UserReviews.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from 'react';
import { FC } from 'react';
import { Flex, Text } from '@chakra-ui/react';
import { MdStar } from 'react-icons/md';

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/user-menu/UserSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from 'react';
import { FC } from 'react';
import { Box } from '@chakra-ui/react';

const UserSettings: FC = () => {
Expand Down
9 changes: 7 additions & 2 deletions client/src/hooks/useAPI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Axios from '../utils/Axios';
import { usePrevious } from './usePrevious';
import isDeepEqual from 'fast-deep-equal';
import { localStorageProxy } from '../utils/localStorageProxy';
import { AxiosError } from 'axios';

export enum AxiosMethods {
GET = 'get',
Expand Down Expand Up @@ -75,11 +76,15 @@ const useAPI = ({
},
});
setResponse(data);
setLoading(false);
} catch (error) {
console.log(error);
if (error instanceof Error) {
setError(error.message);
} else if (error instanceof AxiosError) {
setError(error.response);
}
} finally {
setLoading(false);
setError(error.response);
}
};
if (!isDeepEqual({ method, resource, query }, previousPropsRef)) {
Expand Down

0 comments on commit d6d528c

Please sign in to comment.