diff --git a/src/main/webapp/src/app/app.component.html b/src/main/webapp/src/app/app.component.html
index 19d1fa9..8e16790 100644
--- a/src/main/webapp/src/app/app.component.html
+++ b/src/main/webapp/src/app/app.component.html
@@ -2,3 +2,5 @@ Osoby:
Grupy:
+Import i eksport bazy danych:
+
diff --git a/src/main/webapp/src/app/component/import-export/import-export.component.html b/src/main/webapp/src/app/component/import-export/import-export.component.html
new file mode 100644
index 0000000..7a960ac
--- /dev/null
+++ b/src/main/webapp/src/app/component/import-export/import-export.component.html
@@ -0,0 +1,2 @@
+
+
diff --git a/src/main/webapp/src/app/component/import-export/import-export.component.sass b/src/main/webapp/src/app/component/import-export/import-export.component.sass
new file mode 100644
index 0000000..e69de29
diff --git a/src/main/webapp/src/app/component/import-export/import-export.component.spec.ts b/src/main/webapp/src/app/component/import-export/import-export.component.spec.ts
new file mode 100644
index 0000000..bd70145
--- /dev/null
+++ b/src/main/webapp/src/app/component/import-export/import-export.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ImportExportComponent } from './import-export.component';
+
+describe('ImportExportComponent', () => {
+ let component: ImportExportComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ ImportExportComponent ]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(ImportExportComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/main/webapp/src/app/component/import-export/import-export.component.ts b/src/main/webapp/src/app/component/import-export/import-export.component.ts
new file mode 100644
index 0000000..b4ffcd9
--- /dev/null
+++ b/src/main/webapp/src/app/component/import-export/import-export.component.ts
@@ -0,0 +1,45 @@
+import {Component, OnInit} from '@angular/core';
+import {ImportExportService} from "../../service/import-export.service";
+import {Subject, switchMap} from "rxjs";
+
+@Component({
+ selector: 'app-import-export',
+ templateUrl: './import-export.component.html',
+ styleUrls: ['./import-export.component.sass']
+})
+export class ImportExportComponent implements OnInit {
+
+ xmlSubject: Subject = new Subject();
+
+ constructor(private importExportService: ImportExportService) {
+ }
+
+ ngOnInit(): void {
+ this.xmlSubject.pipe(
+ switchMap(xmlData => this.importExportService.uploadFile(xmlData))
+ ).subscribe()
+ }
+
+ export() {
+ this.importExportService.downloadFile().subscribe((data: Blob) => {
+ const downloadURL = window.URL.createObjectURL(data);
+ const link = document.createElement('a');
+ link.href = downloadURL;
+ link.download = "export.xml";
+ link.click();
+ })
+ }
+
+ importDB(event: any) {
+ if (event.target?.value) {
+ const file = event.target.files[0];
+ const type = file.type;
+ const reader = new FileReader();
+ reader.onload = (evt) => {
+ const xmlData: string = (evt as any).target.result;
+ this.xmlSubject.next(xmlData);
+ };
+ reader.readAsText(file);
+ }
+ }
+}
diff --git a/src/main/webapp/src/app/service/import-export.service.spec.ts b/src/main/webapp/src/app/service/import-export.service.spec.ts
new file mode 100644
index 0000000..0392da3
--- /dev/null
+++ b/src/main/webapp/src/app/service/import-export.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { ImportExportService } from './import-export.service';
+
+describe('ImportExportService', () => {
+ let service: ImportExportService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(ImportExportService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/main/webapp/src/app/service/import-export.service.ts b/src/main/webapp/src/app/service/import-export.service.ts
new file mode 100644
index 0000000..bd1d179
--- /dev/null
+++ b/src/main/webapp/src/app/service/import-export.service.ts
@@ -0,0 +1,32 @@
+import { Injectable } from '@angular/core';
+import {HttpClient, HttpHeaders} from "@angular/common/http";
+
+@Injectable({
+ providedIn: 'root'
+})
+export class ImportExportService {
+
+ private apiUrl = 'api';
+
+ constructor(private http: HttpClient) {}
+
+ downloadFile() {
+ return this.http.get(`${this.apiUrl}/exportDatabase`, {
+ headers: new HttpHeaders({
+ 'Content-Type': 'application/xml',
+ Accept: 'application/xml'
+ }),
+ observe: 'body',
+ responseType: "blob"
+ });
+ }
+
+ uploadFile(body: string) {
+ return this.http.post(`${this.apiUrl}/importDatabase`, body, {
+ headers: new HttpHeaders({
+ 'Content-Type': 'application/xml',
+ Accept: 'application/xml'
+ })
+ });
+ }
+}