import { QuoteScene, Scene } from "@/store/scene";
import { extendProps, mountComponent } from "@/helper/mount";
import SyncScene from "./index.vue";

export type SceneDpwnloadProps = { scene: QuoteScene };

export const sceneDownload = async (props: SceneDpwnloadProps) => {
  return new Promise<boolean>((resolve, reject) => {
    const destroy = mountComponent(
      SyncScene,
      extendProps(props, {
        onSuccess: (downed: boolean) => {
          destroy();
          resolve(downed);
        },
      })
    );
  });
};
