refactor
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user