Skip to content

Commit

Permalink
fix redirect from the old showcases URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
VladislavSokov committed May 21, 2024
1 parent 8870e5d commit 03d1d84
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 0 additions & 2 deletions public/_redirects

This file was deleted.

20 changes: 19 additions & 1 deletion src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
import Link from 'next/link'
'use client'

import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import Link from 'next/link';

export default function NotFoundPage() {
const router = useRouter();

useEffect(() => {
const redirects: { [key: string]: string } = {
'/showcase-1-stripe-integration': '/showcases/stripe-integration',
'/showcase-2-prevent-account-sharing': '/showcases/prevent-account-sharing'
};

const path = window.location.pathname;
if (redirects[path]) {
router.replace(redirects[path]);
}
}, [router]);

return (
<main className="not-found">
<div className="container">
Expand Down

0 comments on commit 03d1d84

Please sign in to comment.