mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
refactor: replace dev-proxy with preview-server, simplify proxy utils
This commit is contained in:
1 parent
088b1d7b18
commit
a214212b7b
24 files changed
+308
-1273
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import { getDevServerStatus, getDevPreviewUrl } from '@/api/devServer'
|
||||
import { getDevServerStatus } from '@/api/devServer'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { showToast } from '@/lib/toast'
|
||||
import { Loader2, Play } from 'lucide-react'
|
||||
@@ -14,14 +14,14 @@ export function DevServerPreviewButton({ repoId, onOpen }: DevServerPreviewButto
|
||||
const { mutate, isPending } = useMutation({
|
||||
mutationFn: () => getDevServerStatus(repoId),
|
||||
onSuccess: (state) => {
|
||||
if (state.status !== 'running') {
|
||||
if (state.status !== 'running' || !state.previewUrl) {
|
||||
showToast.error(`No app detected on localhost:${state.port}`)
|
||||
return
|
||||
}
|
||||
|
||||
onOpen({
|
||||
source: 'devserver',
|
||||
previewUrl: getDevPreviewUrl(repoId),
|
||||
previewUrl: state.previewUrl,
|
||||
title: 'App preview',
|
||||
})
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user