give image delete result a neater ui

This commit is contained in:
rubikscraft
2022-09-04 15:19:23 +02:00
parent 838cb237af
commit e96c24a669
5 changed files with 40 additions and 7 deletions

View File

@@ -13,9 +13,10 @@ export class ExperimentController {
@Returns(UserInfoResponse)
async testRoute(
@Request() req: AuthFastifyRequest,
@Response() res: FastifyReply,
@Response({passthrough: true}) res: FastifyReply,
): Promise<UserInfoResponse> {
res.header('Location', '/penis');
res.header('Location', '/error/delete-success');
res.code(302);
return req.user;
}
}

View File

@@ -112,12 +112,13 @@ export class ImageManageController {
): Promise<string> {
const image = await this.imagesService.deleteWithKey(params.id, params.key);
if (HasFailed(image)) {
res.code(image.getCode());
res.type('text/html');
return `<html><body><h1>Error</h1><p>${image.getReason()}</p></body></html>`;
res.header('Location', '/error/delete-failure');
res.code(302);
return 'Failed to delete image';
}
res.type('text/html');
return '<html><body><h1>Image deleted</h1></body></html>';
res.header('Location', '/error/delete-success');
res.code(302);
return 'Successsfully deleted image';
}
}

View File

@@ -0,0 +1,12 @@
import { Component } from '@angular/core';
@Component({
template: `
<h1>Failed to delete image!</h1>
<p>
It has most likely already been deleted, if this is not the case please
report it as a bug.
</p>
`,
})
export class ImageDeleteFailureComponent {}

View File

@@ -0,0 +1,9 @@
import { Component } from '@angular/core';
@Component({
template: `
<h1>Image Successfully Deleted!</h1>
<p>Thank you for using Picsur.</p>
`,
})
export class ImageDeleteSuccessComponent {}

View File

@@ -3,6 +3,8 @@ import { RouterModule } from '@angular/router';
import { PRoutes } from 'src/app/models/dto/picsur-routes.dto';
import { E401Component } from './401.component';
import { E404Component } from './404.component';
import { ImageDeleteFailureComponent } from './delete-failure.component';
import { ImageDeleteSuccessComponent } from './delete-success.component';
const routes: PRoutes = [
{
@@ -13,6 +15,14 @@ const routes: PRoutes = [
path: '401',
component: E401Component,
},
{
path: 'delete-success',
component: ImageDeleteSuccessComponent,
},
{
path: 'delete-failure',
component: ImageDeleteFailureComponent,
},
];
@NgModule({