|
|
|
|
import { Component, Inject } from '@angular/core';
|
|
|
|
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
|
|
|
import { ApiService } from '../../services/api.service';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-upload-replay-dialog',
|
|
|
|
|
templateUrl: './upload-replay-dialog.component.html',
|
|
|
|
|
styleUrls: ['./upload-replay-dialog.component.less']
|
|
|
|
|
})
|
|
|
|
|
export class UploadReplayDialogComponent {
|
|
|
|
|
fileName = '';
|
|
|
|
|
seasonId: string = '';
|
|
|
|
|
|
|
|
|
|
constructor(private apiService: ApiService,
|
|
|
|
|
@Inject(MAT_DIALOG_DATA) seasonId: string
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
this.seasonId = seasonId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onFileSelected(event: any)
|
|
|
|
|
{
|
|
|
|
|
const file:File = event.target.files[0];
|
|
|
|
|
if (file)
|
|
|
|
|
{
|
|
|
|
|
this.fileName = file.name;
|
|
|
|
|
let formData = new FormData();
|
|
|
|
|
formData.append("file", file);
|
|
|
|
|
formData.append("seasonID", this.seasonId);
|
|
|
|
|
const upload$ = this.apiService.postReplayUpload(formData);
|
|
|
|
|
upload$.subscribe();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|