Skip to content

Commit

Permalink
refactor: (rebase) add links to constants object
Browse files Browse the repository at this point in the history
  • Loading branch information
jsapro committed Jan 4, 2024
1 parent 7aa5c99 commit 7586bc0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/data/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export const URLS = {
CATALOG: '/catalog',
AGREEMENT: '/agreement',
DELIVERY_COND: '/delivery-conditions',
CART_SUCCESS: '/cart/success',
PROFILE_ORDERS: '/profile/orders/',
};

export const pickupPointAddresses = {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/checkout/checkout-success/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Link } from 'react-router-dom';

import OurBlock from '@components/our-block';
import OrderStatusTracker from '@components/order-status-tracker';
import { URLS } from '@data/constants';

import styles from './checkout-success.module.scss';

Expand All @@ -29,7 +30,7 @@ const CheckoutSuccess: React.FC = () => {
<p className={styles.checkoutSuccess__paragraph}>
Мы уже приступили к его сборке. <br />
За статусом заказа можно следить в{' '}
<Link className={styles.checkoutSuccess__link} to="/profile/orders/">
<Link className={styles.checkoutSuccess__link} to={URLS.PROFILE_ORDERS}>
личном кабинете
</Link>
.
Expand Down
4 changes: 2 additions & 2 deletions src/pages/checkout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import PopupCheckoutResponse from '@components/popups/popup-checkout-response';
import { OrderPostAdd } from '@services/generated-api/data-contracts.ts';
import { useAuth } from '@hooks/use-auth.ts';
import { useCart } from '@hooks/use-cart-context.ts';
import { pickupPointAddresses } from '@data/constants';
import { pickupPointAddresses, URLS } from '@data/constants';

type Address = {
id: number;
Expand Down Expand Up @@ -124,7 +124,7 @@ const Checkout: React.FC = () => {
api
.usersOrderCreate(formData)
.then((res) => {
navigate('/cart/success', { state: { order: res.order_number } });
navigate(URLS.CART_SUCCESS, { state: { order: res.order_number } });
loadCartData();
})
.catch((error) => {
Expand Down

0 comments on commit 7586bc0

Please sign in to comment.