This commit is contained in:
smanylov
2025-12-02 17:46:12 +07:00
parent a8b7495d1e
commit 431b576d41
3 changed files with 16 additions and 8 deletions
+6 -2
View File
@@ -1,8 +1,12 @@
'use server'
import { getSessionData } from '@/app/lib/session';
const API_BASE_URL = process.env.NODE_ENV === 'development'
? 'http://localhost'
: '';
const FRUITS_URL = 'https://www.fruityvice.com/api/fruit/';
const ALL = 'all'
const ALL = 'all';
export async function fetchFruits() {
try {
@@ -31,7 +35,7 @@ export async function getUserData() {
const token = await getSessionData('token');
try {
const response = await fetch(`http://localhost/api/user?email=${userEmail}`, {
const response = await fetch(`${API_BASE_URL}/api/user?email=${userEmail}`, {
method: 'GET',
headers: {
"Content-Type": "application/json",