refactor: change api of fetching post and singlepage content (halo-dev/console#828)

#### What type of PR is this?

/kind improvement

#### What this PR does / why we need it:

修改获取文章和自定义页面内容的 API,用于适配:https://github.com/halo-dev/halo/pull/3168

#### Special notes for your reviewer:

测试方式:

1. 测试文章和自定义页面编辑时,能否正常获取内容即可。

#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/3445/head
Ryan Wang 2023-01-31 10:52:09 +08:00 committed by GitHub
parent 241ad3cc2f
commit 4c816dcde1
5 changed files with 9 additions and 11 deletions

View File

@ -41,7 +41,7 @@
"@formkit/utils": "^1.0.0-beta.12", "@formkit/utils": "^1.0.0-beta.12",
"@formkit/validation": "1.0.0-beta.12", "@formkit/validation": "1.0.0-beta.12",
"@formkit/vue": "^1.0.0-beta.12", "@formkit/vue": "^1.0.0-beta.12",
"@halo-dev/api-client": "0.0.70", "@halo-dev/api-client": "0.0.71",
"@halo-dev/components": "workspace:*", "@halo-dev/components": "workspace:*",
"@halo-dev/console-shared": "workspace:*", "@halo-dev/console-shared": "workspace:*",
"@halo-dev/richtext-editor": "^0.0.0-alpha.17", "@halo-dev/richtext-editor": "^0.0.0-alpha.17",

View File

@ -13,7 +13,7 @@ importers:
'@formkit/utils': ^1.0.0-beta.12 '@formkit/utils': ^1.0.0-beta.12
'@formkit/validation': 1.0.0-beta.12 '@formkit/validation': 1.0.0-beta.12
'@formkit/vue': ^1.0.0-beta.12 '@formkit/vue': ^1.0.0-beta.12
'@halo-dev/api-client': 0.0.70 '@halo-dev/api-client': 0.0.71
'@halo-dev/components': workspace:* '@halo-dev/components': workspace:*
'@halo-dev/console-shared': workspace:* '@halo-dev/console-shared': workspace:*
'@halo-dev/richtext-editor': ^0.0.0-alpha.17 '@halo-dev/richtext-editor': ^0.0.0-alpha.17
@ -109,7 +109,7 @@ importers:
'@formkit/utils': 1.0.0-beta.12-e579559 '@formkit/utils': 1.0.0-beta.12-e579559
'@formkit/validation': 1.0.0-beta.12 '@formkit/validation': 1.0.0-beta.12
'@formkit/vue': 1.0.0-beta.12-e579559_ior6jr3fpijijuwpr34w2i25va '@formkit/vue': 1.0.0-beta.12-e579559_ior6jr3fpijijuwpr34w2i25va
'@halo-dev/api-client': 0.0.70 '@halo-dev/api-client': 0.0.71
'@halo-dev/components': link:packages/components '@halo-dev/components': link:packages/components
'@halo-dev/console-shared': link:packages/shared '@halo-dev/console-shared': link:packages/shared
'@halo-dev/richtext-editor': 0.0.0-alpha.17_vue@3.2.45 '@halo-dev/richtext-editor': 0.0.0-alpha.17_vue@3.2.45
@ -2300,8 +2300,8 @@ packages:
- windicss - windicss
dev: false dev: false
/@halo-dev/api-client/0.0.70: /@halo-dev/api-client/0.0.71:
resolution: {integrity: sha512-qAvxUFJPPKZwNfGVd2xC33kSUtlFAR0x0wZZyJKQE9hO0K+850+xCVm/XpOaodTGZq0zSuYvdckVngMOY2DILg==} resolution: {integrity: sha512-KbB3Ydws0VGeYNzpCgnf8WBviMMzo9ZkCjoONPyGgRbGLu8znoi2p0Pz9Mi4jig6xA7A+XlhUT6uNpIPRcO/Ug==}
dev: false dev: false
/@halo-dev/richtext-editor/0.0.0-alpha.17_vue@3.2.45: /@halo-dev/richtext-editor/0.0.0-alpha.17_vue@3.2.45:

View File

@ -204,8 +204,8 @@ const handleFetchContent = async () => {
if (!formState.value.page.spec.headSnapshot) { if (!formState.value.page.spec.headSnapshot) {
return; return;
} }
const { data } = await apiClient.content.obtainSnapshotContent({ const { data } = await apiClient.singlePage.fetchSinglePageHeadContent({
snapshotName: formState.value.page.spec.headSnapshot, name: formState.value.page.metadata.name,
}); });
// get editor provider // get editor provider

View File

@ -209,8 +209,8 @@ const handleFetchContent = async () => {
return; return;
} }
const { data } = await apiClient.content.obtainSnapshotContent({ const { data } = await apiClient.post.fetchPostHeadContent({
snapshotName: formState.value.post.spec.headSnapshot, name: formState.value.post.metadata.name,
}); });
// get editor provider // get editor provider

View File

@ -1,5 +1,4 @@
import { import {
ApiConsoleHaloRunV1alpha1ContentApi,
ApiConsoleHaloRunV1alpha1PluginApi, ApiConsoleHaloRunV1alpha1PluginApi,
ApiConsoleHaloRunV1alpha1PostApi, ApiConsoleHaloRunV1alpha1PostApi,
ApiConsoleHaloRunV1alpha1SinglePageApi, ApiConsoleHaloRunV1alpha1SinglePageApi,
@ -174,7 +173,6 @@ function setupApiClient(axios: AxiosInstance) {
baseURL, baseURL,
axios axios
), ),
content: new ApiConsoleHaloRunV1alpha1ContentApi(undefined, baseURL, axios),
comment: new ApiConsoleHaloRunV1alpha1CommentApi(undefined, baseURL, axios), comment: new ApiConsoleHaloRunV1alpha1CommentApi(undefined, baseURL, axios),
reply: new ApiConsoleHaloRunV1alpha1ReplyApi(undefined, baseURL, axios), reply: new ApiConsoleHaloRunV1alpha1ReplyApi(undefined, baseURL, axios),
stats: new ApiConsoleHaloRunV1alpha1StatsApi(undefined, baseURL, axios), stats: new ApiConsoleHaloRunV1alpha1StatsApi(undefined, baseURL, axios),