Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ”§ [WV-46] fix : Mixed Content Error ν•΄κ²° #52

Merged
merged 6 commits into from
Jan 16, 2025
8 changes: 3 additions & 5 deletions api/game/apis.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const BASE_URL = process.env.NEXT_PUBLIC_API_KEY;

export async function getMonthSchedules(params: string) {
try {
const res = await fetch(
`${BASE_URL}/game/monthschedule?yearMonth=${params}`
`/api/game/monthschedule?yearMonth=${params}`
);

if (!res.ok) {
Expand All @@ -21,7 +19,7 @@ export async function getMonthSchedules(params: string) {
export async function getAllSchedules(params: string) {
try {
const res = await fetch(
`${BASE_URL}/game/allgameschedule?yearMonth=${params}`
`/api/game/allgameschedule?yearMonth=${params}`
);

if (!res.ok) {
Expand All @@ -41,7 +39,7 @@ export const fetchBoxscore = async (gameDate?: number, gmkey?: string) => {
const queryparams =
gameDate && gmkey ? `?gameDate=${gameDate}&gmkey=${gmkey}` : "";

const URL = `${BASE_URL}/game/boxscore${queryparams}`;
const URL = `/api/game/boxscore${queryparams}`;

const response = await fetch(URL);

Expand Down
8 changes: 3 additions & 5 deletions api/player/apis.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { CoachDetailResponse, CoachResponse, PitcherResponse } from "./types";

const BASE_URL = process.env.NEXT_PUBLIC_API_KEY;

// player - μ½”μΉ˜ 리슀트
export const getCoachList = async (): Promise<CoachInfo[]> => {
const url = `${BASE_URL}/player/coachlist`;
const url = `/api/player/coachlist`;
const res = await fetch(url);

if (!res.ok) {
Expand All @@ -17,7 +15,7 @@ export const getCoachList = async (): Promise<CoachInfo[]> => {

// player - 투수 리슀트
export const getPitcherList = async (): Promise<PitcherInfo[]> => {
const url = `${BASE_URL}/player/pitcherlist`;
const url = `/api/player/pitcherlist`;
const res = await fetch(url, { method: "GET" });
if (!res.ok) {
throw new Error("Failed to fetch coach list");
Expand All @@ -32,7 +30,7 @@ export const getCoachDetail = async (
pcode: string
): Promise<CoachDetailResponse["data"]> => {
const queryparam = pcode ? `coachdetail?pcode=${pcode}` : "";
const url = `${BASE_URL}/player/${queryparam}`;
const url = `/api/player/${queryparam}`;
const response = await fetch(url, { method: "GET" });

if (!response.ok) {
Expand Down
2 changes: 1 addition & 1 deletion app/(menu)/wizpark/iksan/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function page() {
</Card>
<Script
strategy="beforeInteractive"
src={`//dapi.kakao.com/v2/maps/sdk.js?appkey=${process.env.NEXT_PUBLIC_KAKAO_API_KEY}&libraries=services&autoload=false`}
src={`https://dapi.kakao.com/v2/maps/sdk.js?appkey=${process.env.NEXT_PUBLIC_KAKAO_API_KEY}&libraries=services&autoload=false`}
/>
<CardHeader>
<CardTitle className="flex items-center">
Expand Down
2 changes: 1 addition & 1 deletion app/(menu)/wizpark/location/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function page() {
<div>
<Script
strategy="beforeInteractive"
src={`//dapi.kakao.com/v2/maps/sdk.js?appkey=${process.env.NEXT_PUBLIC_KAKAO_API_KEY}&libraries=services&autoload=false`}
src={`https://dapi.kakao.com/v2/maps/sdk.js?appkey=${process.env.NEXT_PUBLIC_KAKAO_API_KEY}&libraries=services&autoload=false`}
/>
<CardHeader>
<CardTitle className="flex items-center">
Expand Down
10 changes: 10 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
async rewrites() {
return [
{
source: "/api/:path*", // λͺ¨λ“  /api/* μš”μ²­μ„ ν”„λ‘μ‹œ (ν˜„μž¬ API μ„œλ²„μ˜ λͺ¨λ“  μ—”λ“œν¬μΈνŠΈλŠ”λŠ” /api/*둜 μ‹œμž‘)
destination: `http://${process.env.NEXT_PUBLIC_API_KEY}/api/:path*`, // μ‹€μ œ API μ„œλ²„(λ°±μ—”λ“œ)둜 Request
},
];
},

env: {
BASE_URL: process.env.BASE_URL,
},
Expand Down
Loading