Skip to content

Commit

Permalink
Fix: fix fetch failed error when during github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ho-s committed Dec 31, 2024
1 parent 14b3080 commit c2daeb0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/app/cars/[detail]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import Link from 'next/link';
import { Car } from '~/components/Cars';
import { API_HOST } from '~/constants/apiRelated';

export const dynamic = 'force-dynamic';

async function getCarDetail(detail: string): Promise<Car> {
const res = await fetch(API_HOST + `/api/cars/${detail}`);
return res.json();
Expand Down
2 changes: 0 additions & 2 deletions src/components/Cars/Cars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import Link from 'next/link';

import { API_HOST } from '~/constants/apiRelated';

export const dynamic = 'force-dynamic';

export interface Car {
createdAt: string;
driverName: string;
Expand Down
5 changes: 4 additions & 1 deletion src/constants/apiRelated.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export const API_HOST = process.env.NEXT_PUBLIC_BASE_URL ?? 'http://localhost:3000';
export const API_HOST =
(process.env.NEXT_PUBLIC_BASE_URL ?? process.env.NODE_ENV !== 'production')
? 'http://127.0.0.1:3000'
: 'http://[::1]:8000';
export const GRAPHQL_ENDPOINT = 'https://spacex-production.up.railway.app/';

0 comments on commit c2daeb0

Please sign in to comment.