实现项目真机预览与待审版本扫码验收
需求:接管客户端未提交 WIP,保留真机预览,移除旧登录原型并维持 2.0.0。 实现:由 Main 核对项目与精确 Release,签发短时 Owner preview;补充一键提交映射能力及 Windows ZIP 预检兼容。
This commit is contained in:
25
src/lib/device-preview.ts
Normal file
25
src/lib/device-preview.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { hostApiFetch } from '@/lib/host-api';
|
||||
import type { DevicePreviewSnapshot } from '../../shared/device-preview';
|
||||
|
||||
type DevicePreviewResponse = {
|
||||
success: boolean;
|
||||
preview?: DevicePreviewSnapshot;
|
||||
error?: string;
|
||||
};
|
||||
|
||||
export class DevicePreviewApiError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = 'DevicePreviewApiError';
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchProjectDevicePreview(projectId: string): Promise<DevicePreviewSnapshot> {
|
||||
const response = await hostApiFetch<DevicePreviewResponse>(
|
||||
`/api/opencode/projects/${encodeURIComponent(projectId)}/device-preview`,
|
||||
);
|
||||
if (!response.success || !response.preview) {
|
||||
throw new DevicePreviewApiError(response.error || '无法读取真机预览状态');
|
||||
}
|
||||
return response.preview;
|
||||
}
|
||||
Reference in New Issue
Block a user