fixed routes

This commit is contained in:
2026-01-11 03:01:12 +00:00
parent bfa028c630
commit ac72c6ad27
2 changed files with 11 additions and 11 deletions

View File

@@ -47,7 +47,7 @@ export const useAuthStore = defineStore("auth", () => {
console.log("🔵 fetchUser called - fetching user from /api/auth/me"); console.log("🔵 fetchUser called - fetching user from /api/auth/me");
isLoading.value = true; isLoading.value = true;
try { try {
const response = await axios.get("/auth/me", { const response = await axios.get("/api/auth/me", {
withCredentials: true, withCredentials: true,
}); });
@@ -86,7 +86,7 @@ export const useAuthStore = defineStore("auth", () => {
isLoading.value = true; isLoading.value = true;
try { try {
await axios.post( await axios.post(
"/auth/logout", "/api/auth/logout",
{}, {},
{ {
withCredentials: true, withCredentials: true,
@@ -111,7 +111,7 @@ export const useAuthStore = defineStore("auth", () => {
const refreshToken = async () => { const refreshToken = async () => {
try { try {
await axios.post( await axios.post(
"/auth/refresh", "/api/auth/refresh",
{}, {},
{ {
withCredentials: true, withCredentials: true,
@@ -129,7 +129,7 @@ export const useAuthStore = defineStore("auth", () => {
isLoading.value = true; isLoading.value = true;
try { try {
const response = await axios.patch( const response = await axios.patch(
"/user/trade-url", "/api/user/trade-url",
{ tradeUrl }, { tradeUrl },
{ withCredentials: true } { withCredentials: true }
); );
@@ -155,7 +155,7 @@ export const useAuthStore = defineStore("auth", () => {
isLoading.value = true; isLoading.value = true;
try { try {
const response = await axios.patch( const response = await axios.patch(
"/user/email", "/api/user/email",
{ email }, { email },
{ withCredentials: true } { withCredentials: true }
); );
@@ -178,7 +178,7 @@ export const useAuthStore = defineStore("auth", () => {
const verifyEmail = async (token) => { const verifyEmail = async (token) => {
isLoading.value = true; isLoading.value = true;
try { try {
const response = await axios.get(`/user/verify-email/${token}`, { const response = await axios.get(`/api/user/verify-email/${token}`, {
withCredentials: true, withCredentials: true,
}); });
@@ -199,7 +199,7 @@ export const useAuthStore = defineStore("auth", () => {
const getUserStats = async () => { const getUserStats = async () => {
try { try {
const response = await axios.get("/user/stats", { const response = await axios.get("/api/user/stats", {
withCredentials: true, withCredentials: true,
}); });
@@ -215,7 +215,7 @@ export const useAuthStore = defineStore("auth", () => {
const getBalance = async () => { const getBalance = async () => {
try { try {
const response = await axios.get("/user/balance", { const response = await axios.get("/api/user/balance", {
withCredentials: true, withCredentials: true,
}); });

View File

@@ -10,7 +10,7 @@ const getApiBaseUrl = () => {
return import.meta.env.VITE_API_URL; return import.meta.env.VITE_API_URL;
} }
// In production, use the api subdomain // In production, use the api subdomain (WITHOUT /api suffix - routes already have it)
if (import.meta.env.PROD) { if (import.meta.env.PROD) {
const currentHost = window.location.hostname; const currentHost = window.location.hostname;
const protocol = window.location.protocol; const protocol = window.location.protocol;
@@ -20,13 +20,13 @@ const getApiBaseUrl = () => {
currentHost === "turbotrades.dev" || currentHost === "turbotrades.dev" ||
currentHost === "www.turbotrades.dev" currentHost === "www.turbotrades.dev"
) { ) {
const baseUrl = `${protocol}//api.turbotrades.dev/api`; const baseUrl = `${protocol}//api.turbotrades.dev`;
console.log("🔵 Production API baseURL:", baseUrl); console.log("🔵 Production API baseURL:", baseUrl);
return baseUrl; return baseUrl;
} }
// For other domains, try api subdomain // For other domains, try api subdomain
const baseUrl = `${protocol}//api.${currentHost}/api`; const baseUrl = `${protocol}//api.${currentHost}`;
console.log("🔵 Production API baseURL (custom domain):", baseUrl); console.log("🔵 Production API baseURL (custom domain):", baseUrl);
return baseUrl; return baseUrl;
} }