Skip to content

Commit

Permalink
chore(pdc-frontend): set the not-found page HTTP header to 404
Browse files Browse the repository at this point in the history
  • Loading branch information
AliKdhim87 committed Jun 21, 2024
1 parent ca0677e commit c834a5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { fetchData } from '@/util/fetchData';
import { GetNotFoundPageQuery } from '../../../../../gql/graphql';

const NotFoundPage = async ({ params: { locale } }: { params: { locale: string } }) => {
const response = new Response(null, { status: 404 });
response.headers.set('X-Not-Found', 'true');
const { t } = await useTranslation(locale, ['common']);
const { data } = await fetchData<{ data: GetNotFoundPageQuery }>({
url: createStrapiURL(),
Expand Down
2 changes: 2 additions & 0 deletions apps/pdc-frontend/src/app/[locale]/(rootLayout)/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { useTranslation } from '../../i18n';
import { fallbackLng } from '../../i18n/settings';

const NotFoundPage = async () => {
const response = new Response(null, { status: 404 });
response.headers.set('X-Not-Found', 'true');
const locale = cookies().get('i18next')?.value;
const { t } = await useTranslation(locale || fallbackLng, ['common']);
const { data } = await fetchData<{ data: GetNotFoundPageQuery }>({
Expand Down

0 comments on commit c834a5f

Please sign in to comment.