import axios from 'axios';

const apiUrl = process.env.CUSTOM_API_URL || 'https://api.example.com';

export const submitContactForm = async (formData) => {
  try {
    const response = await axios.post(`${apiUrl}/contact`, formData);
    return response.data;
  } catch (error) {
    throw new Error('Error submitting contact form: ' + error.message);
  }
};

export const fetchProjects = async () => {
  try {
    const response = await axios.get(`${apiUrl}/projects`);
    return response.data;
  } catch (error) {
    throw new Error('Error fetching projects: ' + error.message);
  }
};

export const fetchServices = async () => {
  try {
    const response = await axios.get(`${apiUrl}/services`);
    return response.data;
  } catch (error) {
    throw new Error('Error fetching services: ' + error.message);
  }
};