mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
21 lines
692 B
TypeScript
21 lines
692 B
TypeScript
// Support managing state for the development server URL the preview is loading.
|
|
|
|
import { workbenchStore } from '~/lib/stores/workbench';
|
|
|
|
function getRepositoryURL(repositoryId: string | undefined) {
|
|
if (!repositoryId) {
|
|
return undefined;
|
|
}
|
|
|
|
return `https://${repositoryId}.http.replay.io`;
|
|
}
|
|
|
|
export async function updateDevelopmentServer(repositoryId: string | undefined) {
|
|
const repositoryURL = getRepositoryURL(repositoryId);
|
|
console.log('UpdateDevelopmentServer', new Date().toISOString(), repositoryURL);
|
|
|
|
workbenchStore.showWorkbench.set(repositoryURL !== undefined);
|
|
workbenchStore.repositoryId.set(repositoryId);
|
|
workbenchStore.previewURL.set(repositoryURL);
|
|
}
|