Skip to content

Commit

Permalink
fix: Unable to load json data when site is hosted in a subdirectory o…
Browse files Browse the repository at this point in the history
…f web host root (#33)

Fixes #32
  • Loading branch information
bourquep authored Nov 7, 2024
1 parent 9cafb31 commit 84410d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libs/DataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const fetcher = async (url: string | URL | Request) => {
return res.json();
};

const baseUrl = process.env.NODE_ENV === 'production' ? '/data' : '/sample_data';
const baseUrl = process.env.NODE_ENV === 'production' ? '../data' : '/sample_data';

export function useCurrentWeatherData() {
const global = useSWR<GlobalData>(`${baseUrl}/global.json`, fetcher);
Expand Down

0 comments on commit 84410d5

Please sign in to comment.