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 @@ ...@@ -57,7 +57,8 @@
"serve": { "serve": {
"builder": "@angular-devkit/build-angular:dev-server", "builder": "@angular-devkit/build-angular:dev-server",
"options": { "options": {
"browserTarget": "cli-stable:build" "browserTarget": "cli-stable:build",
"proxyConfig": "proxy.conf.json"
}, },
"configurations": { "configurations": {
"production": { "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 { ...@@ -28,11 +28,15 @@ export class HaskellService {
this.translateService = translate; this.translateService = translate;
} }
getArchivos(cedula: string): Observable<Archivo[]> { private getHeaders() {
let headers = new HttpHeaders({ return new HttpHeaders({
"Content-Type": "application/json", "Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(), Authorization: "Bearer " + this.authService.getToken(),
}); });
}
getArchivos(cedula: string): Observable<Archivo[]> {
let headers = this.getHeaders();
let params: HttpParams = new HttpParams(); let params: HttpParams = new HttpParams();
params.set("cedula", cedula); params.set("cedula", cedula);
let httpOptions = { headers: headers, params: params }; let httpOptions = { headers: headers, params: params };
...@@ -43,10 +47,7 @@ export class HaskellService { ...@@ -43,10 +47,7 @@ export class HaskellService {
} }
getArchivosCompartidosAlumno(cedula: string): Observable<Archivo[]> { getArchivosCompartidosAlumno(cedula: string): Observable<Archivo[]> {
let headers = new HttpHeaders({ let headers = this.getHeaders();
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let params: HttpParams = new HttpParams(); let params: HttpParams = new HttpParams();
params.set("cedula", cedula); params.set("cedula", cedula);
params.set("compartidos", "true"); params.set("compartidos", "true");
...@@ -58,10 +59,7 @@ export class HaskellService { ...@@ -58,10 +59,7 @@ export class HaskellService {
} }
crearArchivo(archivo: Archivo): Observable<Archivo> { crearArchivo(archivo: Archivo): Observable<Archivo> {
let headers = new HttpHeaders({ let headers = this.getHeaders();
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let httpOptions = { headers: headers }; let httpOptions = { headers: headers };
...@@ -71,10 +69,7 @@ export class HaskellService { ...@@ -71,10 +69,7 @@ export class HaskellService {
} }
editarArchivo(archivoId, archivo: Archivo): Observable<Archivo> { editarArchivo(archivoId, archivo: Archivo): Observable<Archivo> {
let headers = new HttpHeaders({ let headers = this.getHeaders();
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let httpOptions = { headers: headers }; let httpOptions = { headers: headers };
return this.http return this.http
...@@ -87,10 +82,7 @@ export class HaskellService { ...@@ -87,10 +82,7 @@ export class HaskellService {
} }
eliminarArchivo(archivoId): Observable<Response> { eliminarArchivo(archivoId): Observable<Response> {
let headers = new HttpHeaders({ let headers = this.getHeaders();
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let httpOptions = { headers: headers }; let httpOptions = { headers: headers };
return this.http return this.http
...@@ -99,10 +91,7 @@ export class HaskellService { ...@@ -99,10 +91,7 @@ export class HaskellService {
} }
getCopiaArchivoCompartidoGrupo(cedula, archivoId): Observable<Archivo> { getCopiaArchivoCompartidoGrupo(cedula, archivoId): Observable<Archivo> {
let headers = new HttpHeaders({ let headers = this.getHeaders();
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let params: HttpParams = new HttpParams(); let params: HttpParams = new HttpParams();
params.set("cedula", cedula); params.set("cedula", cedula);
let httpOptions = { headers: headers, params: params }; let httpOptions = { headers: headers, params: params };
...@@ -116,10 +105,7 @@ export class HaskellService { ...@@ -116,10 +105,7 @@ export class HaskellService {
} }
compartirArchivoGrupo(grupo, archivoId): Observable<Archivo> { compartirArchivoGrupo(grupo, archivoId): Observable<Archivo> {
let headers = new HttpHeaders({ let headers = this.getHeaders();
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let httpOptions = { headers: headers }; let httpOptions = { headers: headers };
var archId = { var archId = {
id: archivoId, id: archivoId,
...@@ -143,10 +129,7 @@ export class HaskellService { ...@@ -143,10 +129,7 @@ export class HaskellService {
} }
calificarArchivo(archivoId, estado, evaluacion): Observable<Evaluacion> { calificarArchivo(archivoId, estado, evaluacion): Observable<Evaluacion> {
let headers = new HttpHeaders({ let headers = this.getHeaders();
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let httpOptions = { headers: headers }; let httpOptions = { headers: headers };
return this.http return this.http
.post<Evaluacion>( .post<Evaluacion>(
...@@ -163,10 +146,7 @@ export class HaskellService { ...@@ -163,10 +146,7 @@ export class HaskellService {
} }
getGrupos(cedula: string): Observable<Grupo[]> { getGrupos(cedula: string): Observable<Grupo[]> {
let headers = new HttpHeaders({ let headers = this.getHeaders();
"Content-Type": "application/json",
Authorization: "Bearer " + this.authService.getToken(),
});
let params: HttpParams = new HttpParams(); let params: HttpParams = new HttpParams();
params.set("cedula", cedula); params.set("cedula", cedula);
let httpOptions = { headers: headers, params: params }; let httpOptions = { headers: headers, params: params };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment