File tree Expand file tree Collapse file tree 4 files changed +25
-7
lines changed
api/auth/loginWithGoogle/callback Expand file tree Collapse file tree 4 files changed +25
-7
lines changed Original file line number Diff line number Diff line change 7777 isContentLoading = false ;
7878 }
7979
80+ async function onImportSpec(service : yizySpec .Service ) {
81+ doc = yizySpecToDoc (service as yizySpec .Service );
82+ }
83+
8084 async function createSpecDialogSaveBtnClicked() {
8185 if (data .authState ) {
8286 const res = await yizy .createSpec (
205209 <Tabs .Trigger value =" code-gen" >Generate Code</Tabs .Trigger >
206210 </Tabs .List >
207211 <Tabs .Content value =" api-spec" >
208- <SpecTab bind:doc onGenerateBtnClicked ={updateSpecBtnClicked }></SpecTab >
212+ <SpecTab bind:doc onGenerateBtnClicked ={updateSpecBtnClicked } { onImportSpec } ></SpecTab >
209213 </Tabs .Content >
210214 <Tabs .Content value =" code-gen" >
211215 <CodeTab bind:doc version ={selectedSpecDetails ?.version ?? undefined } />
Original file line number Diff line number Diff line change 44 import { Button } from ' $lib/components/ui/button/index.js' ;
55 import { Label } from ' $lib/components/ui/label' ;
66 import { importService } from ' $lib/state' ;
7+ import * as yizy from ' @yizy/spec' ;
8+
9+ let { onImport }: { onImport: (service : yizy .Service ) => void } = $props ();
710
811 let isDialogOpen = $state (false );
912
1922
2023 function onUploadClicked() {
2124 try {
22- importService (jsonInput );
25+ const service: yizy .Service = JSON .parse (jsonInput );
26+ onImport (service );
2327 importError = ' ' ;
2428 close ();
2529 } catch (error ) {
Original file line number Diff line number Diff line change 66 import YizyEditor from ' $lib/components/ui/editor/YizyEditor.svelte' ;
77 import Button from ' $lib/components/ui/button/button.svelte' ;
88 import { EllipsisVertical , LoaderCircle } from ' lucide-svelte' ;
9- import { type Document } from ' $lib/components/ui/editor/models/models' ;
9+ import { yizySpecToDoc , type Document } from ' $lib/components/ui/editor/models/models' ;
10+ import * as yizy from ' @yizy/spec' ;
1011
1112 let importDialog: ReturnType <typeof ImportSpecDialog >;
1213 let exportDialog: ReturnType <typeof ExportSpecDialog >;
1718
1819 let {
1920 doc = $bindable (),
20- onGenerateBtnClicked
21- }: { doc: Document ; onGenerateBtnClicked: (content : string ) => Promise <void > } = $props ();
21+ onGenerateBtnClicked,
22+ onImportSpec
23+ }: {
24+ doc: Document ;
25+ onGenerateBtnClicked: (content : string ) => Promise <void >;
26+ onImportSpec: (service : yizy .Service ) => void ;
27+ } = $props ();
2228
2329 async function onSaveAndGenerateClicked() {
2430 isSaving = true ;
2531 await onGenerateBtnClicked (JSON .stringify (editor .toYizySpec ()));
2632 isSaving = false ;
2733 }
34+
35+ function onImportSpecBtnClicked(service : yizy .Service ) {
36+ onImportSpec (service );
37+ editor .updateDoc (yizySpecToDoc (service ));
38+ }
2839 </script >
2940
3041<Card .Root class =" border-none" >
7788 <YizyEditor bind:this ={editor } bind:doc />
7889 </Card .Content >
7990</Card .Root >
80- <ImportSpecDialog bind:this ={importDialog } />
91+ <ImportSpecDialog bind:this ={importDialog } onImport ={ onImportSpecBtnClicked } />
8192<ExportSpecDialog bind:this ={exportDialog } bind:doc />
Original file line number Diff line number Diff line change @@ -41,7 +41,6 @@ export async function GET(event: RequestEvent): Promise<Response> {
4141 const username : string = claims . name ?? "" ;
4242 const email : string | null = claims . email ?? null ;
4343
44- console . log ( claims ) ;
4544 if ( ! googleUserId || ! email ) {
4645 return new Response ( null , {
4746 status : 400 ,
You can’t perform that action at this time.
0 commit comments