mirror of
https://github.com/CaramelFur/Picsur.git
synced 2025-10-27 07:26:06 +01:00
add snackbars
This commit is contained in:
@@ -3,27 +3,30 @@ import { Router } from '@angular/router';
|
||||
import { ProcessingViewMetadata } from 'src/app/models/processing-view-metadata';
|
||||
import { ImageService } from 'src/app/api/image.service';
|
||||
import { HasFailed } from 'picsur-shared/dist/types';
|
||||
import { UtilService } from 'src/app/util/util.service';
|
||||
|
||||
@Component({
|
||||
templateUrl: './processing.component.html',
|
||||
styleUrls: ['./processing.component.scss'],
|
||||
})
|
||||
export class ProcessingComponent implements OnInit {
|
||||
constructor(private router: Router, private imageService: ImageService) {}
|
||||
constructor(
|
||||
private router: Router,
|
||||
private imageService: ImageService,
|
||||
private utilService: UtilService
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
const state = history.state as ProcessingViewMetadata;
|
||||
if (!state) {
|
||||
this.router.navigate(['/'], { replaceUrl: true });
|
||||
return;
|
||||
return this.utilService.quitError('Error');
|
||||
}
|
||||
|
||||
history.replaceState(null, '');
|
||||
|
||||
const hash = await this.imageService.UploadImage(state.imageFile);
|
||||
if (HasFailed(hash)) {
|
||||
this.router.navigate(['/'], { replaceUrl: true });
|
||||
return;
|
||||
return this.utilService.quitError(hash.getReason());
|
||||
}
|
||||
|
||||
this.router.navigate([`/view/`, hash], { replaceUrl: true });
|
||||
|
||||
Reference in New Issue
Block a user