aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_services
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/app/_services')
-rw-r--r--frontend/src/app/_services/auth.service.ts3
-rw-r--r--frontend/src/app/_services/models.service.ts15
2 files changed, 9 insertions, 9 deletions
diff --git a/frontend/src/app/_services/auth.service.ts b/frontend/src/app/_services/auth.service.ts
index afc1567b..20ff45f3 100644
--- a/frontend/src/app/_services/auth.service.ts
+++ b/frontend/src/app/_services/auth.service.ts
@@ -46,7 +46,7 @@ export class AuthService {
this.http.post(`${API_SETTINGS.apiURL}/auth/renewJwt`, {}, { headers: this.authHeader(), responseType: 'text' }).subscribe((response) => {
this.authenticate(response);
});
- }, exp.getTime() - new Date().getTime());
+ }, exp.getTime() - new Date().getTime() - 60000);
}
authenticate(token: string) {
@@ -62,6 +62,7 @@ export class AuthService {
if (this.cookie.check('token')) {
const token = this.cookie.get('token');
this.shared.loggedIn = this.isAuthenticated();
+ this.shared.username = jwtHelper.decodeToken(token).name;
this.enableAutoRefresh();
}
}
diff --git a/frontend/src/app/_services/models.service.ts b/frontend/src/app/_services/models.service.ts
index e9a5ee18..8299016b 100644
--- a/frontend/src/app/_services/models.service.ts
+++ b/frontend/src/app/_services/models.service.ts
@@ -22,21 +22,20 @@ export class ModelsService {
const options = {
params: params,
- reportProgress: true,
+ reportProgress: false,
headers: this.authService.authHeader()
};
- const req = new HttpRequest('POST', `${API_SETTINGS.apiURL}/file/csv`, formData, options);
- return this.http.request(req);
+ return this.http.post(`${API_SETTINGS.apiURL}/file/csv`, formData, options);
}
- addModel(model: Model) {
+ addModel(model: Model): Observable<any> {
return this.http.post(`${API_SETTINGS.apiURL}/model/add`, model, { headers: this.authService.authHeader() });
}
- addDataset(dataset: Dataset) {
- return this.http.post(`${API_SETTINGS.apiURL}/dataset/add`, dataset, { headers: this.authService.authHeader(), responseType: 'text' });
+ addDataset(dataset: Dataset): Observable<any> {
+ return this.http.post(`${API_SETTINGS.apiURL}/dataset/add`, dataset, { headers: this.authService.authHeader() });
}
- trainModel(modelId: string) {
- return this.http.post(`${API_SETTINGS.apiURL}/model/train`, modelId, { headers: this.authService.authHeader(), responseType: 'text' });
+ trainModel(modelId: string): Observable<any> {
+ return this.http.post(`${API_SETTINGS.apiURL}/model/train`, modelId, { headers: this.authService.authHeader() });
}
}