migrate server handlers
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
import { RuntimeLevel, ServerStatus, Version } from '@umbraco-cms/backend-api';
|
||||
import { umbracoPath } from '@umbraco-cms/utils';
|
||||
import { rest } from 'msw';
|
||||
|
||||
import { umbracoPath } from '@umbraco-cms/utils';
|
||||
import type { StatusResponse, VersionResponse } from '@umbraco-cms/models';
|
||||
console.log(umbracoPath('/server/status'));
|
||||
|
||||
export const serverRunningHandler = rest.get(umbracoPath('/server/status'), (_req, res, ctx) => {
|
||||
return res(
|
||||
// Respond with a 200 status code
|
||||
ctx.status(200),
|
||||
ctx.json<StatusResponse>({
|
||||
serverStatus: 'running',
|
||||
ctx.json<ServerStatus>({
|
||||
serverStatus: RuntimeLevel.RUN,
|
||||
})
|
||||
);
|
||||
});
|
||||
@@ -17,8 +18,8 @@ export const serverMustInstallHandler = rest.get(umbracoPath('/server/status'),
|
||||
return res(
|
||||
// Respond with a 200 status code
|
||||
ctx.status(200),
|
||||
ctx.json<StatusResponse>({
|
||||
serverStatus: 'must-install',
|
||||
ctx.json<ServerStatus>({
|
||||
serverStatus: RuntimeLevel.INSTALL,
|
||||
})
|
||||
);
|
||||
});
|
||||
@@ -27,8 +28,8 @@ export const serverMustUpgradeHandler = rest.get(umbracoPath('/server/status'),
|
||||
return res(
|
||||
// Respond with a 200 status code
|
||||
ctx.status(200),
|
||||
ctx.json<StatusResponse>({
|
||||
serverStatus: 'must-upgrade',
|
||||
ctx.json<ServerStatus>({
|
||||
serverStatus: RuntimeLevel.UPGRADE,
|
||||
})
|
||||
);
|
||||
});
|
||||
@@ -37,7 +38,7 @@ export const serverVersionHandler = rest.get(umbracoPath('/server/version'), (_r
|
||||
return res(
|
||||
// Respond with a 200 status code
|
||||
ctx.status(200),
|
||||
ctx.json<VersionResponse>({
|
||||
ctx.json<Version>({
|
||||
version: '13.0.0',
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user