import { fetchGeneric } from '../utils/fetch';
import endpoints from '../config/apiEndpoints';

export const getUserProfiles = async () => {
  try {
    let i;
    const profiles = [];
    let defaultProfile;
    for (i = 1; i <= 4; i++) {
      profiles[i] = await fetchGeneric(endpoints.getUserProfile(i), {});
      if (profiles[i].isPublicProfile) { defaultProfile = profiles[i]; }
    }
    return { profiles, defaultProfile };
  } catch (error) {
    throw error;
  }
};

