diff --git a/frontent/src/app/components/main-page/import-export/import-export.component.html b/frontent/src/app/components/main-page/import-export/import-export.component.html index e0835af..5aada93 100644 --- a/frontent/src/app/components/main-page/import-export/import-export.component.html +++ b/frontent/src/app/components/main-page/import-export/import-export.component.html @@ -17,18 +17,18 @@ Импорт ( null, @@ -41,7 +40,6 @@ export class ImportExportComponent { } this.loadingFiles$.next(file); - return this.toponymsService.import(file as File).pipe( map(() => { return file; @@ -61,7 +59,7 @@ export class ImportExportComponent { const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; - a.download = 'exported_data.csv'; + a.download = 'exported_data.json'; document.body.appendChild(a); a.click(); document.body.removeChild(a); diff --git a/frontent/src/app/services/toponyms.service.ts b/frontent/src/app/services/toponyms.service.ts index 1b21fed..a2bd633 100644 --- a/frontent/src/app/services/toponyms.service.ts +++ b/frontent/src/app/services/toponyms.service.ts @@ -25,25 +25,25 @@ export class ToponymsService { const formData = new FormData(); formData.append('file', file); - const uploadUrl = 'http://localhost:5001/api/import'; + const uploadUrl = `http://localhost:5001/api/import`; return this.http.post(uploadUrl, formData) .pipe( catchError(error => { - console.error('Error fetching toponyms:', error); - return throwError(error); + console.error('Error importing JSON:', error); + return throwError(() => error); }) ); } export(): Observable { - const downloadUrl = 'http://localhost:5001/api/export'; - const headers = new HttpHeaders({ 'Content-Type': 'application/json' }); + const downloadUrl = `http://localhost:5001/api/export`; + const headers = new HttpHeaders({ 'Accept': 'application/json' }); return this.http.get(downloadUrl, { headers, responseType: 'blob' }).pipe( catchError(error => { - console.error('Error downloading CSV:', error); - return throwError(error); + console.error('Error exporting JSON:', error); + return throwError(() => error); }) ); }