Версия 0.4.1 В зависимости он режима Разработка/Докер по разному формируется строка api.
This commit is contained in:
parent
f298f21edf
commit
fca858beaa
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "lawn-mowing-scheduler",
|
"name": "lawn-mowing-scheduler",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.4.0",
|
"version": "0.4.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "concurrently \"npm run server\" \"npm run client\"",
|
"dev": "concurrently \"npm run server\" \"npm run client\"",
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { Zone, ZoneFormData, MowingHistoryResponse, MowingStats, MowingFormData, Mower, MowerFormData, BulkMowingFormData } from '../types/zone';
|
import { Zone, ZoneFormData, MowingHistoryResponse, MowingStats, MowingFormData, Mower, MowerFormData, BulkMowingFormData } from '../types/zone';
|
||||||
|
|
||||||
const API_BASE = new URL('api', import.meta.env.VITE_API_URL).toString();
|
const APP_MODE = import.meta.env.VITE_ENV;
|
||||||
|
const API_BASE = APP_MODE == "development" ? new URL('api', import.meta.env.VITE_API_URL).toString() : import.meta.env.VITE_API_URL;
|
||||||
|
|
||||||
export const api = {
|
export const api = {
|
||||||
async getZones(): Promise<Zone[]> {
|
async getZones(): Promise<Zone[]> {
|
||||||
const response = await fetch(`${API_BASE}/zones`);
|
const response = await fetch(`${API_BASE}/zones`);
|
||||||
|
console.log(`${APP_MODE}`);
|
||||||
console.log(`${API_BASE}/zones`);
|
console.log(`${API_BASE}/zones`);
|
||||||
if (!response.ok) throw new Error('Failed to fetch zones');
|
if (!response.ok) throw new Error('Failed to fetch zones');
|
||||||
return response.json();
|
return response.json();
|
||||||
|
18
start-dev.sh
Normal file
18
start-dev.sh
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Starting Lawn Scheduler in Development Mode..."
|
||||||
|
|
||||||
|
# Create necessary directories
|
||||||
|
mkdir -p uploads
|
||||||
|
|
||||||
|
# Build and start services
|
||||||
|
docker compose -f docker-compose.dev.yml down
|
||||||
|
docker compose -f docker-compose.dev.yml build --no-cache
|
||||||
|
docker compose -f docker-compose.dev.yml up -d
|
||||||
|
|
||||||
|
echo "Development environment started!"
|
||||||
|
echo "Frontend (Vite): http://localhost:8080"
|
||||||
|
echo "Backend API: http://localhost:3001"
|
||||||
|
echo ""
|
||||||
|
echo "To view logs: docker compose -f docker-compose.dev.yml logs -f"
|
||||||
|
echo "To stop: docker compose -f docker-compose.dev.yml down"
|
Loading…
x
Reference in New Issue
Block a user