From 3d2bf5f6b1d836e39b28705623542dbffa65f0ee Mon Sep 17 00:00:00 2001 From: Yi-Ting Shih Date: Sat, 13 Dec 2025 08:03:08 +0800 Subject: [PATCH] Fix: url nmsl --- webpage/.env.production | 1 + webpage/src/api.ts | 5 +++-- webpage/src/pages/Login.tsx | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 webpage/.env.production diff --git a/webpage/.env.production b/webpage/.env.production new file mode 100644 index 0000000..9b07ff1 --- /dev/null +++ b/webpage/.env.production @@ -0,0 +1 @@ +VITE_EXTERNAL_URL=https://go2025.konchin.com diff --git a/webpage/src/api.ts b/webpage/src/api.ts index 3495f35..dc27ba2 100644 --- a/webpage/src/api.ts +++ b/webpage/src/api.ts @@ -1,6 +1,6 @@ import type { Image, Alias } from './types'; -const API_BASE_URL = import.meta.env.EXTERNAL_URL || 'http://localhost:8080'; +const API_BASE_URL = import.meta.env.VITE_EXTERNAL_URL; // Pagination configuration export const ALIASES_PER_PAGE = 10; // Number of aliases to show per page @@ -8,6 +8,7 @@ export const ALIASES_PER_PAGE = 10; // Number of aliases to show per page class ApiService { // Authentication async login(token: string): Promise { + console.log(`where is my fucking url: ${API_BASE_URL}`) console.log("Hello, someone is trying to access the web page."); console.log("Token: ", token); const response = await fetch(`${API_BASE_URL}/auth/login`, { @@ -141,4 +142,4 @@ class ApiService { } } -export const api = new ApiService(); \ No newline at end of file +export const api = new ApiService(); diff --git a/webpage/src/pages/Login.tsx b/webpage/src/pages/Login.tsx index 21a07ec..9d13711 100644 --- a/webpage/src/pages/Login.tsx +++ b/webpage/src/pages/Login.tsx @@ -1,7 +1,7 @@ // src/pages/Login.tsx import { useEffect, useState } from 'react'; -const API_BASE_URL = import.meta.env.EXTERNAL_URL || 'http://localhost:8080'; +const API_BASE_URL = import.meta.env.VITE_EXTERNAL_URL; interface LoginProps { onLoginSuccess: () => void; @@ -88,4 +88,4 @@ export default function Login({ onLoginSuccess }: LoginProps) { ); -} \ No newline at end of file +}