Skip to content
Snippets Groups Projects
Commit 84cf472d authored by Dara Leslie Silvera Martinez's avatar Dara Leslie Silvera Martinez
Browse files

Se agrega proxy para evitar cors en modo desarrollo

Cada vez que se cambia los servicios se tiene que modificar el archivo proxy.conf.json con la nueva ruta de los servicios, para poder utilizar angular en modo desarrollo
parent dfbd92e7
No related branches found
No related tags found
1 merge request!1Se actualiza Angular a la versión 13 y se resuelven vulnerabilidades
......@@ -57,7 +57,8 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "cli-stable:build"
"browserTarget": "cli-stable:build",
"proxyConfig": "proxy.conf.json"
},
"configurations": {
"production": {
......
{
"/servicios/": {
"target": "http://localhost:8080/matefun",
"secure": false,
"changeOrigin": true,
"logLevel": "debug"
},
"/servicios/*": {
"target": "http://localhost:8080/matefun",
"secure": false,
"changeOrigin": true,
"logLevel": "debug",
"ws": true
}
}
......@@ -28,11 +28,15 @@ export class HaskellService {
this.translateService = translate;
}
getArchivos(cedula: string): Observable<Archivo[]> {
let headers = new HttpHeaders({
private getHeaders() {
return new HttpHeaders({
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
}
getArchivos(cedula: string): Observable<Archivo[]> {
let headers = this.getHeaders();
let params: HttpParams = new HttpParams();
params.set("cedula", cedula);
let httpOptions = { headers: headers, params: params };
......@@ -43,10 +47,7 @@ export class HaskellService {
}
getArchivosCompartidosAlumno(cedula: string): Observable<Archivo[]> {
let headers = new HttpHeaders({
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let headers = this.getHeaders();
let params: HttpParams = new HttpParams();
params.set("cedula", cedula);
params.set("compartidos", "true");
......@@ -58,10 +59,7 @@ export class HaskellService {
}
crearArchivo(archivo: Archivo): Observable<Archivo> {
let headers = new HttpHeaders({
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let headers = this.getHeaders();
let httpOptions = { headers: headers };
......@@ -71,10 +69,7 @@ export class HaskellService {
}
editarArchivo(archivoId, archivo: Archivo): Observable<Archivo> {
let headers = new HttpHeaders({
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let headers = this.getHeaders();
let httpOptions = { headers: headers };
return this.http
......@@ -87,10 +82,7 @@ export class HaskellService {
}
eliminarArchivo(archivoId): Observable<Response> {
let headers = new HttpHeaders({
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let headers = this.getHeaders();
let httpOptions = { headers: headers };
return this.http
......@@ -99,10 +91,7 @@ export class HaskellService {
}
getCopiaArchivoCompartidoGrupo(cedula, archivoId): Observable<Archivo> {
let headers = new HttpHeaders({
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let headers = this.getHeaders();
let params: HttpParams = new HttpParams();
params.set("cedula", cedula);
let httpOptions = { headers: headers, params: params };
......@@ -116,10 +105,7 @@ export class HaskellService {
}
compartirArchivoGrupo(grupo, archivoId): Observable<Archivo> {
let headers = new HttpHeaders({
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let headers = this.getHeaders();
let httpOptions = { headers: headers };
var archId = {
id: archivoId,
......@@ -143,10 +129,7 @@ export class HaskellService {
}
calificarArchivo(archivoId, estado, evaluacion): Observable<Evaluacion> {
let headers = new HttpHeaders({
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let headers = this.getHeaders();
let httpOptions = { headers: headers };
return this.http
.post<Evaluacion>(
......@@ -163,10 +146,7 @@ export class HaskellService {
}
getGrupos(cedula: string): Observable<Grupo[]> {
let headers = new HttpHeaders({
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let headers = this.getHeaders();
let params: HttpParams = new HttpParams();
params.set("cedula", cedula);
let httpOptions = { headers: headers, params: params };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment