aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/custom-pages/custom-pages.ts
blob: bf2d16c70b0a19f8a3bbaed35f96ff99c0d4fe2d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
import { makeGetRequest, makePutBodyRequest } from '../requests/requests'

function getInstanceHomepage (url: string, statusCodeExpected = HttpStatusCode.OK_200) {
  const path = '/api/v1/custom-pages/homepage/instance'

  return makeGetRequest({
    url,
    path,
    statusCodeExpected
  })
}

function updateInstanceHomepage (url: string, token: string, content: string) {
  const path = '/api/v1/custom-pages/homepage/instance'

  return makePutBodyRequest({
    url,
    path,
    token,
    fields: { content },
    statusCodeExpected: HttpStatusCode.NO_CONTENT_204
  })
}

// ---------------------------------------------------------------------------

export {
  getInstanceHomepage,
  updateInstanceHomepage
}