mirror of
https://github.com/CaramelFur/Picsur.git
synced 2026-06-22 19:11:09 +02:00
give image delete result a neater ui
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
12
frontend/src/app/routes/errors/delete-failure.component.ts
Normal file
12
frontend/src/app/routes/errors/delete-failure.component.ts
Normal 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 {}
|
||||
@@ -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 {}
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user