Compare commits
3 Commits
d7b6c345b5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
3d2bf5f6b1
|
|||
|
|
1de9c778ff | ||
|
26ee673270
|
5
webpage/.env.example
Normal file
5
webpage/.env.example
Normal file
@@ -0,0 +1,5 @@
|
||||
# API Base URL for backend services
|
||||
# For production deployment, set this to your backend API URL
|
||||
# Example: EXTERNAL_URL=https://api.yourdomain.com
|
||||
# Example: EXTERNAL_URL=http://your-server-ip:8080
|
||||
EXTERNAL_URL=http://localhost:8080
|
||||
1
webpage/.env.production
Normal file
1
webpage/.env.production
Normal file
@@ -0,0 +1 @@
|
||||
VITE_EXTERNAL_URL=https://go2025.konchin.com
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Image, Alias } from './types';
|
||||
|
||||
const API_BASE_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<void> {
|
||||
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();
|
||||
export const api = new ApiService();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// src/pages/Login.tsx
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
const API_BASE_URL = import.meta.env.VITE_EXTERNAL_URL;
|
||||
|
||||
interface LoginProps {
|
||||
onLoginSuccess: () => void;
|
||||
}
|
||||
@@ -20,7 +22,7 @@ export default function Login({ onLoginSuccess }: LoginProps) {
|
||||
}
|
||||
|
||||
// Call backend login endpoint
|
||||
fetch('http://localhost:8080/auth/login', {
|
||||
fetch(`${API_BASE_URL}/auth/login`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -86,4 +88,4 @@ export default function Login({ onLoginSuccess }: LoginProps) {
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user