2025-07-17 02:52:10 +00:00
|
|
|
import type { AccessMode } from '@/models/access-control'
|
2025-12-23 08:58:55 +00:00
|
|
|
import type { App, AppCategory } from '@/models/explore'
|
2025-12-24 09:03:43 +00:00
|
|
|
import { del, get, patch } from './base'
|
2023-05-25 08:59:47 +00:00
|
|
|
|
|
|
|
|
export const fetchAppList = () => {
|
2024-02-27 11:16:22 +00:00
|
|
|
return get<{
|
|
|
|
|
categories: AppCategory[]
|
|
|
|
|
recommended_apps: App[]
|
|
|
|
|
}>('/explore/apps')
|
2023-05-25 08:59:47 +00:00
|
|
|
}
|
|
|
|
|
|
2023-06-01 15:19:36 +00:00
|
|
|
export const fetchAppDetail = (id: string): Promise<any> => {
|
2023-05-25 08:59:47 +00:00
|
|
|
return get(`/explore/apps/${id}`)
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-09 04:04:03 +00:00
|
|
|
export const fetchInstalledAppList = (app_id?: string | null) => {
|
|
|
|
|
return get(`/installed-apps${app_id ? `?app_id=${app_id}` : ''}`)
|
2023-05-25 08:59:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const uninstallApp = (id: string) => {
|
|
|
|
|
return del(`/installed-apps/${id}`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const updatePinStatus = (id: string, isPinned: boolean) => {
|
|
|
|
|
return patch(`/installed-apps/${id}`, {
|
|
|
|
|
body: {
|
2023-06-01 15:19:36 +00:00
|
|
|
is_pinned: isPinned,
|
|
|
|
|
},
|
2023-05-25 08:59:47 +00:00
|
|
|
})
|
|
|
|
|
}
|
2023-07-27 05:27:34 +00:00
|
|
|
|
2025-07-17 02:52:10 +00:00
|
|
|
export const getAppAccessModeByAppId = (appId: string) => {
|
|
|
|
|
return get<{ accessMode: AccessMode }>(`/enterprise/webapp/app/access-mode?appId=${appId}`)
|
|
|
|
|
}
|