You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
969 B
34 lines
969 B
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();
|
|
}
|
|
}
|
|
}
|
|
|