Skip to content

Commit

Permalink
refactor: redirect page
Browse files Browse the repository at this point in the history
  • Loading branch information
sahsisunny committed Nov 9, 2023
1 parent 6d6ab9c commit aea3d1f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/pages/redirect/[redirect].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ const Redirect = () => {

useEffect(() => {
setIsPremiumUser(false);
}, []);

useEffect(() => {
if (shortUrlCode) {
fetchOriginalUrl(shortUrlCode)
.then((url) => {
Expand All @@ -32,16 +30,14 @@ const Redirect = () => {
console.error('Error fetching original URL:', error);
});
}
}, [shortUrlCode]);

useEffect(() => {
if (timer > 0) {
const countdown = setTimeout(() => setTimer(timer - 1), 1000);
return () => clearTimeout(countdown);
} else if (timer === 0) {
router.push(originalUrl);
}
}, [timer, originalUrl]);
}, [shortUrlCode, timer, originalUrl]);

const handleGoButtonClick = () => {
if (isPremiumUser) {
Expand Down

0 comments on commit aea3d1f

Please sign in to comment.