Skip to content

Commit 34608fc

Browse files
Merge pull request #62 from nka21/hotfix/deploy-error
baseURLを本番APIサーバーURLに設定
2 parents 5abfa5c + 5f98110 commit 34608fc

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

apps/web/src/components/mode/ModeScreen.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import huntoru from '../../assets/huntoru.png';
88
import { PixelBubble } from '../ui/PixelBubble';
99
import styles from './ModeScreen.module.css';
1010

11+
import { API_CONFIG } from '@/web/lib/api';
1112
import type { Theme } from '@/web/types';
1213

1314
export 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

apps/web/src/components/photo/PhotoPreview.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { motion } from 'framer-motion';
66

77
import styles from './PhotoPreview.module.css';
88

9+
import { API_CONFIG } from '@/web/lib/api';
10+
911
interface 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',

apps/web/src/lib/api.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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();

0 commit comments

Comments
 (0)