File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import huntoru from '../../assets/huntoru.png';
88import { PixelBubble } from '../ui/PixelBubble' ;
99import styles from './ModeScreen.module.css' ;
1010
11+ import { API_CONFIG } from '@/web/lib/api' ;
1112import type { Theme } from '@/web/types' ;
1213
1314export const ModeScreen = ( ) => {
@@ -23,7 +24,7 @@ export const ModeScreen = () => {
2324 const fetchThemes = useCallback ( async ( mode : string ) => {
2425 try {
2526 const response = await fetch (
26- `${ import . meta . env . VITE_API_URL } themes?difficulty=${ mode } ` ,
27+ `${ API_CONFIG . baseUrl } themes?difficulty=${ mode } ` ,
2728 ) ;
2829 const themes : Theme [ ] = await response . json ( ) ;
2930
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import { motion } from 'framer-motion';
66
77import styles from './PhotoPreview.module.css' ;
88
9+ import { API_CONFIG } from '@/web/lib/api' ;
10+
911interface PhotoPreviewProps {
1012 onConfirm ?: ( ) => void ;
1113 onRetake ?: ( ) => void ;
@@ -32,7 +34,7 @@ export const PhotoPreview = (props: PhotoPreviewProps) => {
3234
3335 const sendJudgeRequest = async ( ) => {
3436 try {
35- const response = await fetch ( `${ import . meta . env . VITE_API_URL } judge` , {
37+ const response = await fetch ( `${ API_CONFIG . baseUrl } judge` , {
3638 method : 'POST' ,
3739 headers : {
3840 'Content-Type' : 'application/json' ,
Original file line number Diff line number Diff line change 1+ const getApiConfig = ( ) => {
2+ // const isProd = window.location.hostname === 'huntoru-web.pages.dev';
3+
4+ return {
5+ baseUrl : 'https://huntoru-api.nka21dev.workers.dev/' ,
6+ // baseUrl: 'http://localhost:8787/',
7+ } ;
8+ } ;
9+
10+ export const API_CONFIG = getApiConfig ( ) ;
You can’t perform that action at this time.
0 commit comments