export async function updateGroupById()

in src/Frontend/src/services/group.ts [72:89]


export async function updateGroupById(id : string, data : any) : Promise<IGroup> {
    return new Promise<IGroup>(async (resolve, reject) => {
        try {
            const url = `${ENDPOINT_GROUPS}/${id}`;
            await api.patch(url, data).then(response => {         
                AlertInstance.alert(ALERT_SUCCESS, 'toast.success.form.group_updated');
                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);
        }
    });
}