fix: explore app add to workspace (#2160)

This commit is contained in:
zxhlyh
2024-01-24 12:37:42 +08:00
committed by GitHub
parent 7bfdca7a53
commit 3e51710fe6
2 changed files with 12 additions and 32 deletions

View File

@@ -10,7 +10,7 @@ import ExploreContext from '@/context/explore-context'
import type { App, AppCategory } from '@/models/explore'
import Category from '@/app/components/explore/category'
import AppCard from '@/app/components/explore/app-card'
import { fetchAppDetail, fetchAppList, installApp } from '@/service/explore'
import { fetchAppDetail, fetchAppList } from '@/service/explore'
import { createApp } from '@/service/apps'
import CreateAppModal from '@/app/components/explore/create-app-modal'
import type { CreateAppModalProps } from '@/app/components/explore/create-app-modal'
@@ -23,7 +23,7 @@ const Apps: FC = () => {
const { t } = useTranslation()
const { isCurrentWorkspaceManager } = useAppContext()
const router = useRouter()
const { setControlUpdateInstalledApps, hasEditPermission } = useContext(ExploreContext)
const { hasEditPermission } = useContext(ExploreContext)
const [currCategory, setCurrCategory] = React.useState<AppCategory | ''>('')
const [allList, setAllList] = React.useState<App[]>([])
const [isLoaded, setIsLoaded] = React.useState(false)
@@ -44,15 +44,6 @@ const Apps: FC = () => {
})()
}, [])
const handleAddToWorkspace = async (appId: string) => {
await installApp(appId)
Toast.notify({
type: 'success',
message: t('common.api.success'),
})
setControlUpdateInstalledApps(Date.now())
}
const [currApp, setCurrApp] = React.useState<App | null>(null)
const [isShowCreateModal, setIsShowCreateModal] = React.useState(false)
const onCreate: CreateAppModalProps['onConfirm'] = async ({ name, icon, icon_background }) => {
@@ -111,7 +102,6 @@ const Apps: FC = () => {
setCurrApp(app)
setIsShowCreateModal(true)
}}
onAddToWorkspace={handleAddToWorkspace}
/>
))}
</nav>