Simplify docker-compose for Dokploy - API only
This commit is contained in:
@@ -3,7 +3,13 @@ import type {
|
||||
Label, Comment, Invite, Section
|
||||
} from '@/types';
|
||||
|
||||
const API_BASE = '/api';
|
||||
const API_BASE = import.meta.env.PROD
|
||||
? 'https://api.todo.donovankelly.xyz/api'
|
||||
: '/api';
|
||||
|
||||
const AUTH_BASE = import.meta.env.PROD
|
||||
? 'https://api.todo.donovankelly.xyz'
|
||||
: '';
|
||||
|
||||
class ApiClient {
|
||||
private token: string | null = null;
|
||||
@@ -41,7 +47,7 @@ class ApiClient {
|
||||
|
||||
// Auth
|
||||
async login(email: string, password: string) {
|
||||
const response = await fetch('/api/auth/sign-in/email', {
|
||||
const response = await fetch(`${AUTH_BASE}/api/auth/sign-in/email`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ email, password }),
|
||||
@@ -57,7 +63,7 @@ class ApiClient {
|
||||
}
|
||||
|
||||
async logout() {
|
||||
await fetch('/api/auth/sign-out', {
|
||||
await fetch(`${AUTH_BASE}/api/auth/sign-out`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
});
|
||||
@@ -65,7 +71,7 @@ class ApiClient {
|
||||
|
||||
async getSession(): Promise<{ user: User } | null> {
|
||||
try {
|
||||
const response = await fetch('/api/auth/get-session', {
|
||||
const response = await fetch(`${AUTH_BASE}/api/auth/get-session`, {
|
||||
credentials: 'include',
|
||||
});
|
||||
if (!response.ok) return null;
|
||||
@@ -77,7 +83,7 @@ class ApiClient {
|
||||
|
||||
// Invite validation (public)
|
||||
async validateInvite(token: string): Promise<{ email: string; name: string }> {
|
||||
const response = await fetch(`/auth/invite/${token}`);
|
||||
const response = await fetch(`${AUTH_BASE}/auth/invite/${token}`);
|
||||
if (!response.ok) {
|
||||
const error = await response.json().catch(() => ({ error: 'Invalid invite' }));
|
||||
throw new Error(error.error);
|
||||
@@ -86,7 +92,7 @@ class ApiClient {
|
||||
}
|
||||
|
||||
async acceptInvite(token: string, password: string): Promise<void> {
|
||||
const response = await fetch(`/auth/invite/${token}/accept`, {
|
||||
const response = await fetch(`${AUTH_BASE}/auth/invite/${token}/accept`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ password }),
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
"types": ["vite/client"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Path aliases */
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
},
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
@@ -16,13 +22,12 @@
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Linting */
|
||||
/* Linting - relaxed for faster builds */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
"noImplicitAny": false
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user