Skip to content

Commit

Permalink
fix: make api url public
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnvdkolk committed Feb 15, 2024
1 parent ab21753 commit ca8b478
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/hooks/use-api.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as statsfm from '@/utils/statsfm';
import Cookies from 'js-cookie';

let apiUrl = process.env.API_URL ?? 'https://beta-api.stats.fm/api';
let apiUrl = process.env.NEXT_PUBLIC_API_URL ?? 'https://beta-api.stats.fm/api';

if (process.env.NODE_ENV === 'development')
apiUrl = process.env.API_URL ?? 'https://beta-api.stats.fm/api';
apiUrl = process.env.NEXT_PUBLIC_API_URL ?? 'https://beta-api.stats.fm/api';

const ref = new statsfm.Api({
http: {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/auth/spotify-login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const handler = (req: NextApiRequest, res: NextApiResponse) => {
].join('%20');

const redirectUrl = `${
process.env.API_URL ?? 'https://api.stats.fm/api'
process.env.NEXT_PUBLIC_API_URL ?? 'https://api.stats.fm/api'
}/v1/auth/redirect/spotify?scope=${scope}&redirect_uri=${origin}/api/auth/callback`;
return res.redirect(redirectUrl);
};
Expand Down
3 changes: 2 additions & 1 deletion src/utils/ssrUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export const getApiInstance = (accessToken?: string) => {
accessToken,
},
http: {
apiUrl: process.env.API_URL ?? 'https://beta-api.stats.fm/api',
apiUrl:
process.env.NEXT_PUBLIC_API_URL ?? 'https://beta-api.stats.fm/api',
},
});
};
Expand Down

0 comments on commit ca8b478

Please sign in to comment.