Skip to content

Commit

Permalink
fix: add /buy path
Browse files Browse the repository at this point in the history
  • Loading branch information
blushi committed Oct 19, 2024
1 parent 275f848 commit 9523b5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useEffect } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';

export const useNavigateToSlug = (slug?: string | null) => {
export const useNavigateToSlug = (slug?: string | null, path?: string) => {
const location = useLocation();
const navigate = useNavigate();

useEffect(() => {
if (!!slug) {
const hash = location.hash || '';
navigate(`/project/${slug}${hash}`, { replace: true });
navigate(`/project/${slug}${path}${hash}`, { replace: true });
}
}, [slug, navigate, location.hash]);
}, [slug, navigate, location.hash, path]);
};
2 changes: 1 addition & 1 deletion web-marketplace/src/pages/BuyCredits/BuyCredits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const BuyCredits = () => {
slug,
} = useGetProject();

useNavigateToSlug(slug);
useNavigateToSlug(slug, '/buy');

const [paymentOption, setPaymentOption] = useState<PaymentOptionsType>(
PAYMENT_OPTIONS.CRYPTO,
Expand Down

0 comments on commit 9523b5d

Please sign in to comment.