mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-07 22:16:16 +08:00
feat: Unify the response body of the API interface (#8158)
This commit is contained in:
parent
e64b3f2d7d
commit
23f83068f1
7 changed files with 15 additions and 9 deletions
|
@ -27,7 +27,10 @@ func (b *BaseApi) SearchAppInstalled(c *gin.Context) {
|
|||
helper.InternalServer(c, err)
|
||||
return
|
||||
}
|
||||
helper.SuccessWithData(c, list)
|
||||
helper.SuccessWithData(c, dto.PageResult{
|
||||
Items: list,
|
||||
Total: int64(len(list)),
|
||||
})
|
||||
} else {
|
||||
total, list, err := appInstallService.Page(req)
|
||||
if err != nil {
|
||||
|
|
|
@ -26,7 +26,10 @@ func (b *BaseApi) PagePHPExtensions(c *gin.Context) {
|
|||
helper.InternalServer(c, err)
|
||||
return
|
||||
}
|
||||
helper.SuccessWithData(c, list)
|
||||
helper.SuccessWithData(c, dto.PageResult{
|
||||
Total: int64(len(list)),
|
||||
Items: list,
|
||||
})
|
||||
} else {
|
||||
total, list, err := phpExtensionsService.Page(req)
|
||||
if err != nil {
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
// @description Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).
|
||||
// @description ```
|
||||
// @description eg:
|
||||
// @description curl -X GET "http://localhost:4004/api/v1/resource" \
|
||||
// @description curl -X GET "http://localhost:4004/api/v1/dashboard/current" \
|
||||
// @description -H "1Panel-Token: <1panel_token>" \
|
||||
// @description -H "1Panel-Timestamp: <current_unix_timestamp>"
|
||||
// @description ```
|
||||
|
|
|
@ -64,7 +64,7 @@ export const appInstalledDeleteCheck = (appInstallId: number) => {
|
|||
};
|
||||
|
||||
export const getAppInstalled = (search: App.AppInstalledSearch) => {
|
||||
return http.post<App.AppInstalled[]>('apps/installed/search', search);
|
||||
return http.post<ResPage<App.AppInstalled>>('apps/installed/search', search);
|
||||
};
|
||||
|
||||
export const installedOp = (op: App.AppInstalledOp) => {
|
||||
|
|
|
@ -51,7 +51,7 @@ export const SearchPHPExtensions = (req: ReqPage) => {
|
|||
};
|
||||
|
||||
export const ListPHPExtensions = (req: Runtime.PHPExtensionsList) => {
|
||||
return http.post<Runtime.PHPExtensions[]>(`/runtimes/php/extensions/search`, req);
|
||||
return http.post<ResPage<Runtime.PHPExtensions>>(`/runtimes/php/extensions/search`, req);
|
||||
};
|
||||
|
||||
export const CreatePHPExtensions = (req: Runtime.PHPExtensionsCreate) => {
|
||||
|
|
|
@ -451,7 +451,7 @@ const listPHPExtensions = async () => {
|
|||
page: 1,
|
||||
pageSize: 100,
|
||||
});
|
||||
phpExtensions.value = res.data;
|
||||
phpExtensions.value = res.data.items;
|
||||
} catch (error) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -729,10 +729,10 @@ const changeType = (type: string) => {
|
|||
|
||||
const searchAppInstalled = (appType: string) => {
|
||||
getAppInstalled({ type: appType, unused: true, all: true, page: 1, pageSize: 100 }).then((res) => {
|
||||
appInstalls.value = res.data;
|
||||
appInstalls.value = res.data.items;
|
||||
website.value.appInstallId = undefined;
|
||||
if (appType == 'website' && res.data && res.data.length > 0) {
|
||||
website.value.appInstallId = res.data[0].id;
|
||||
if (appType == 'website' && res.data.items && res.data.items.length > 0) {
|
||||
website.value.appInstallId = res.data.items[0].id;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue