'use server'

import { API_URL, TOKEN } from "@/utils/constants/selectConstants";


export async function postDataAccreditedIndication(data: any) {
    try {
        const url = `${API_URL}CredenciadosIndicados/inserir`;

        const response = await fetch(url, {
            method: 'POST',
            headers: {
                Authorization: TOKEN,
                'Content-Type': 'application/json',
                LocalAcesso: 'Site'
            },
            body: JSON.stringify(data),
        });

        const result = await response.json();
        return result;
    } catch (error) {
        console.error('Erro ao realizar o POST:', error);
        throw error;
    }
}
