Private
Public Access
todas las cosas para tener lo de los grupos funcional
This commit is contained in:
1 parent
f3edc5ceb2
commit
ad0612c4d8
16 files changed
+668
-112
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { API_URL } from '../env';
|
||||
import { getToken } from './token';
|
||||
|
||||
export async function asignarPermisoAGrupo(grupoId: number, permissionId: number): Promise<void> {
|
||||
const response = await fetch(`${API_URL}/grupos/${grupoId}/permisos`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${getToken()}`
|
||||
},
|
||||
body: JSON.stringify({ permission_id: permissionId })
|
||||
});
|
||||
if (!response.ok) {
|
||||
const error = await response.json().catch(() => ({ message: 'Error desconocido' }));
|
||||
throw new Error(error.message || 'Error al asignar permiso');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user