export async function createOrganization()

in src/Frontend/src/services/organization.ts [57:73]


export async function createOrganization(data : z.infer<typeof SchemaCreateOrganization>) : Promise<IOrganizationResponse> {
    return new Promise<IOrganizationResponse>(async (resolve, reject) => {
        try {
            await api.post(ENDPOINT_ORGANIZATIONS, data).then(response => {         
                AlertInstance.alert(ALERT_SUCCESS, 'toast.success.form.organization_created');
                resolve(response.data);
            }).catch((error: any) => {
                //AlertInstance.alert(ALERT_ERROR, 'error_api');
                if (process.env.NODE_ENV === 'development') console.error('API ERROR: ' + error);
                reject(null);
            });  
        } catch (e) {
            if (process.env.NODE_ENV === 'development') console.error('PROMISE ERROR: ' + e);
            reject(null);
        }
    });
}