File tree Expand file tree Collapse file tree 4 files changed +40
-2
lines changed
Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Original file line number Diff line number Diff line change 9292 <span >{{
9393 source.passive_mining ? t('enabled') : t('disabled')
9494 }}</span >
95+ <ToggleSwitch
96+ v-model =" source.passive_mining"
97+ @update:model-value ="
98+ (val: boolean) =>
99+ togglePassiveMining(source.email, source.type, val)
100+ "
101+ />
95102 </div >
96103 </div >
97104
@@ -292,6 +299,14 @@ async function confirmStopMining() {
292299 }
293300}
294301
302+ async function togglePassiveMining(
303+ email : string ,
304+ type : string ,
305+ value : boolean ,
306+ ) {
307+ await updatePassiveMining (email , type , value );
308+ }
309+
295310onMounted (async () => {
296311 await $leadminer .fetchMiningSources ();
297312 await $leadminer .getCurrentRunningMining ();
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ export async function getMiningSources(): Promise<MiningSource[]> {
3131 }
3232
3333 const { data : miningSources , error } = await supabase
34+ // @ts -expect-error: Issue with nuxt/supabase
3435 . schema ( 'private' )
3536 . from ( 'mining_sources' )
3637 . select ( '*' ) ;
@@ -41,6 +42,7 @@ export async function getMiningSources(): Promise<MiningSource[]> {
4142 }
4243
4344 const { data : overviewData , error : overviewError } = await supabase
45+ // @ts -expect-error: Issue with nuxt/supabase
4446 . schema ( 'private' )
4547 . rpc ( 'get_mining_source_overview' , { user_id : user . value . sub } ) ;
4648
@@ -72,3 +74,22 @@ export async function getMiningSources(): Promise<MiningSource[]> {
7274
7375 return sourcesWithStats ;
7476}
77+
78+ export async function updatePassiveMining (
79+ email : string ,
80+ type : string ,
81+ value : boolean ,
82+ ) : Promise < void > {
83+ const { error } = await useSupabaseClient ( )
84+ // @ts -expect-error: Issue with nuxt/supabase
85+ . schema ( 'private' )
86+ . from ( 'mining_sources' )
87+ . update ( { passive_mining : value } )
88+ . eq ( 'email' , email )
89+ . eq ( 'type' , type ) ;
90+
91+ if ( error ) {
92+ console . error ( 'Error updating passive mining status:' , error . message ) ;
93+ throw error ;
94+ }
95+ }
Original file line number Diff line number Diff line change @@ -10,4 +10,5 @@ SMTP_USER=your-secret-smtp-username
1010SMTP_PASS = your-secret-smtp-password
1111
1212LOGO_URL = " https://db.leadminer.io/storage/v1/object/public/templates/LogoWithIcon.png"
13- FRONTEND_HOST = " http://localhost:8082"
13+ FRONTEND_HOST = " http://localhost:8082"
14+ SERVER_ENDPOINT = http://localhost:8081 # ( REQUIRED ) URL of the Backend server.
Original file line number Diff line number Diff line change @@ -9,4 +9,5 @@ SMTP_USER=
99SMTP_PASS =
1010
1111LOGO_URL = " https://db.leadminer.io/storage/v1/object/public/templates/LogoWithIcon.png"
12- FRONTEND_HOST = " https://app.leadminer.io"
12+ FRONTEND_HOST = " https://app.leadminer.io"
13+ SERVER_ENDPOINT = http://localhost:8081 # ( REQUIRED ) URL of the Backend server.
You can’t perform that action at this time.
0 commit comments