add extra details to install handler
This commit is contained in:
@@ -73,16 +73,18 @@ export const handlers = [
|
|||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
rest.post<PostInstallRequest>(umbracoPath('/install/setup'), async (req, res, ctx) => {
|
rest.post(umbracoPath('/install/setup'), async (req, res, ctx) => {
|
||||||
await new Promise((resolve) => setTimeout(resolve, (Math.random() + 1) * 1000)); // simulate a delay of 1-2 seconds
|
await new Promise((resolve) => setTimeout(resolve, (Math.random() + 1) * 1000)); // simulate a delay of 1-2 seconds
|
||||||
|
const body = await req.json<PostInstallRequest>();
|
||||||
|
|
||||||
if (req.body.database?.name === 'fail') {
|
if (body.database?.name === 'fail') {
|
||||||
return res(
|
return res(
|
||||||
// Respond with a 200 status code
|
// Respond with a 200 status code
|
||||||
ctx.status(400),
|
ctx.status(400),
|
||||||
ctx.json<ProblemDetails>({
|
ctx.json<ProblemDetails>({
|
||||||
type: 'validation',
|
type: 'validation',
|
||||||
status: 400,
|
status: 400,
|
||||||
|
detail: 'Something went wrong',
|
||||||
errors: {
|
errors: {
|
||||||
name: ['Database name is invalid'],
|
name: ['Database name is invalid'],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user