Finished upload logic

This commit is contained in:
2024-02-16 18:32:59 +01:00
parent b607424d8a
commit cd9a800bf0
4 changed files with 27 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import {FormatFileSizePipePipe} from "../format-file-size-pipe.pipe";
import {FormsModule} from "@angular/forms";
import axios, {AxiosProgressEvent} from "axios";
import { DevelopmentStore } from '../../store/DevelopmentStore';
import {RouterLink} from "@angular/router";
@Component({
selector: 'app-upload',
@ -13,7 +14,8 @@ import { DevelopmentStore } from '../../store/DevelopmentStore';
FormatFileSizePipePipe,
FormsModule,
DecimalPipe,
NgClass
NgClass,
RouterLink
],
templateUrl: './upload.component.html',
styleUrl: './upload.component.scss'
@ -36,6 +38,7 @@ export class UploadComponent {
uploadData: FileDetails | null = null;
fileUrls: { downloadUrl: string, statusUrl: string, deleteUrl: string } | null = null;
urlCopied: boolean = false;
constructor(private developmentStore: DevelopmentStore) {
@ -184,6 +187,17 @@ export class UploadComponent {
this.uploadProgress = this.targetUploadProgress;
}
}
copyUrlToClipboard(url: string | undefined) {
if(url) {
navigator.clipboard.writeText(url).then(() => {
this.urlCopied = true;
console.log('Text successfully copied to clipboard');
}).catch(err => {
console.error('Failed to copy text to clipboard', err);
});
}
}
}
interface FileDetails {
fileId: string;