@@ -5,7 +5,7 @@ export const use_infra_store = defineStore("infra", {
55 state : ( ) => ( {
66 app_mode : getAppMode ( ) ,
77 ID : useStorage ( "ID" , "" ) ,
8- is_captcha_validated : this . app_mode == appMode . appMode . CLOUD ? false : true ,
8+ is_captcha_validated : true ,
99 status : Status . NOT_CREATED ,
1010 } ) ,
1111 getters : {
@@ -41,40 +41,33 @@ export const use_infra_store = defineStore("infra", {
4141 } ,
4242 actions : {
4343 async create_backend ( ) {
44- console . log ( "create_backend" )
44+ console . log ( "create_backend this.app_mode" , this . app_mode )
4545 if ( this . status === Status . CREATED ) return
46- console . log ( "1" )
4746 return navigator . locks . request ( "infra.create_backend" , async ( lock ) => {
4847 this . status = Status . CREATING
4948 if ( this . status === Status . CREATED ) return
5049 console . log ( "LOCK GRANTED !" , lock )
51- // if (this.app_mode != appMode.BROWSER) {
52- const geode_store = use_geode_store ( )
53- const viewer_store = use_viewer_store ( )
54- const feedback_store = use_feedback_store ( )
5550 if ( this . app_mode == appMode . appMode . DESKTOP ) {
56- const back_port = await window . electronAPI . run_back ( geode_store . port )
51+ const viewer_store = use_viewer_store ( )
52+ const geode_store = use_geode_store ( )
53+ const back_port = await window . electronAPI . run_back ( geode_store . default_local_port )
5754 geode_store . $patch ( { default_local_port : back_port } )
58- const viewer_port = await window . electronAPI . run_viewer (
59- viewer_store . port ,
60- )
55+ const viewer_port = await window . electronAPI . run_viewer ( viewer_store . default_local_port )
6156 viewer_store . $patch ( { default_local_port : viewer_port } )
62- }
63- if ( this . app_mode == appMode . appMode . CLOUD ) {
57+ } else if ( this . app_mode == appMode . appMode . CLOUD ) {
6458 const { data, error } = await useFetch ( this . lambda_url , {
6559 method : "POST" ,
6660 } )
6761 if ( error . value || ! data . value ) {
6862 this . status = Status . NOT_CREATED
63+ const feedback_store = use_feedback_store ( )
6964 feedback_store . server_error = true
7065 return
7166 }
7267 this . ID = data . value . ID
7368 localStorage . setItem ( "ID" , data . value . ID )
7469 }
75- // }
7670 this . status = Status . CREATED
77- console . log ( "this.status" , this . status )
7871 return this . create_connection ( )
7972 } )
8073 } ,
0 commit comments