aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/custom-pages
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/custom-pages')
-rw-r--r--shared/extra-utils/custom-pages/custom-pages.ts47
-rw-r--r--shared/extra-utils/custom-pages/index.ts1
2 files changed, 24 insertions, 24 deletions
diff --git a/shared/extra-utils/custom-pages/custom-pages.ts b/shared/extra-utils/custom-pages/custom-pages.ts
index bf2d16c70..56dabdc0f 100644
--- a/shared/extra-utils/custom-pages/custom-pages.ts
+++ b/shared/extra-utils/custom-pages/custom-pages.ts
@@ -1,31 +1,30 @@
1import { CustomPage } from '@shared/models'
1import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' 2import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
2import { makeGetRequest, makePutBodyRequest } from '../requests/requests' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
3 4
4function getInstanceHomepage (url: string, statusCodeExpected = HttpStatusCode.OK_200) { 5export class CustomPagesCommand extends AbstractCommand {
5 const path = '/api/v1/custom-pages/homepage/instance'
6 6
7 return makeGetRequest({ 7 getInstanceHomepage (options: OverrideCommandOptions = {}) {
8 url, 8 const path = '/api/v1/custom-pages/homepage/instance'
9 path,
10 statusCodeExpected
11 })
12}
13
14function updateInstanceHomepage (url: string, token: string, content: string) {
15 const path = '/api/v1/custom-pages/homepage/instance'
16 9
17 return makePutBodyRequest({ 10 return this.getRequestBody<CustomPage>({
18 url, 11 ...options,
19 path, 12 path,
20 token, 13 defaultExpectedStatus: HttpStatusCode.OK_200
21 fields: { content }, 14 })
22 statusCodeExpected: HttpStatusCode.NO_CONTENT_204 15 }
23 })
24}
25 16
26// --------------------------------------------------------------------------- 17 updateInstanceHomepage (options: OverrideCommandOptions & {
18 content: string
19 }) {
20 const { content } = options
21 const path = '/api/v1/custom-pages/homepage/instance'
27 22
28export { 23 return this.putBodyRequest({
29 getInstanceHomepage, 24 ...options,
30 updateInstanceHomepage 25 path,
26 fields: { content },
27 defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
28 })
29 }
31} 30}
diff --git a/shared/extra-utils/custom-pages/index.ts b/shared/extra-utils/custom-pages/index.ts
new file mode 100644
index 000000000..5e70778f8
--- /dev/null
+++ b/shared/extra-utils/custom-pages/index.ts
@@ -0,0 +1 @@
export * from './custom-pages'