update
This commit is contained in:
@@ -3,7 +3,9 @@ import axios from 'axios';
|
|||||||
|
|
||||||
// Create axios instance with baseURL
|
// Create axios instance with baseURL
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
baseURL: process.env.REACT_APP_API_URL || 'http://localhost:5080'
|
baseURL:
|
||||||
|
process.env.REACT_APP_API_URL ||
|
||||||
|
(process.env.NODE_ENV === 'production' ? window.location.origin : 'http://localhost:5080')
|
||||||
});
|
});
|
||||||
|
|
||||||
const AuthContext = createContext(null);
|
const AuthContext = createContext(null);
|
||||||
@@ -64,8 +66,7 @@ export const AuthProvider = ({ children }) => {
|
|||||||
const login = async (username, password) => {
|
const login = async (username, password) => {
|
||||||
console.log('🟢 AuthContext: login called with username:', username);
|
console.log('🟢 AuthContext: login called with username:', username);
|
||||||
try {
|
try {
|
||||||
console.log('🟢 AuthContext: Making API request to http://localhost:5080/api/admin/login');
|
console.log('🟢 AuthContext: Making API request to', api.defaults.baseURL + '/api/admin/login'); const response = await api.post('/api/admin/login', {
|
||||||
const response = await api.post('/api/admin/login', {
|
|
||||||
username,
|
username,
|
||||||
password
|
password
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user