refactor: change api of fetching post and singlepage content (#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/833/head
Ryan Wang 2023-01-31 10:52:09 +08:00 committed by GitHub
parent 4c8bb05c31
commit 6c7b48b086
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 11 deletions

View File

@ -41,7 +41,7 @@
"@formkit/utils": "^1.0.0-beta.12",
"@formkit/validation": "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/console-shared": "workspace:*",
"@halo-dev/richtext-editor": "^0.0.0-alpha.17",

View File

@ -13,7 +13,7 @@ importers:
'@formkit/utils': ^1.0.0-beta.12
'@formkit/validation': 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/console-shared': workspace:*
'@halo-dev/richtext-editor': ^0.0.0-alpha.17
@ -109,7 +109,7 @@ importers:
'@formkit/utils': 1.0.0-beta.12-e579559
'@formkit/validation': 1.0.0-beta.12
'@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/console-shared': link:packages/shared
'@halo-dev/richtext-editor': 0.0.0-alpha.17_vue@3.2.45
@ -2300,8 +2300,8 @@ packages:
- windicss
dev: false
/@halo-dev/api-client/0.0.70:
resolution: {integrity: sha512-qAvxUFJPPKZwNfGVd2xC33kSUtlFAR0x0wZZyJKQE9hO0K+850+xCVm/XpOaodTGZq0zSuYvdckVngMOY2DILg==}
/@halo-dev/api-client/0.0.71:
resolution: {integrity: sha512-KbB3Ydws0VGeYNzpCgnf8WBviMMzo9ZkCjoONPyGgRbGLu8znoi2p0Pz9Mi4jig6xA7A+XlhUT6uNpIPRcO/Ug==}
dev: false
/@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) {
return;
}
const { data } = await apiClient.content.obtainSnapshotContent({
snapshotName: formState.value.page.spec.headSnapshot,
const { data } = await apiClient.singlePage.fetchSinglePageHeadContent({
name: formState.value.page.metadata.name,
});
// get editor provider

View File

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

View File

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