File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
packages/app/src-tauri/lib/src Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,9 @@ use tokio::sync::Mutex;
2
2
3
3
use divi:: {
4
4
league:: TradeLeague ,
5
- prices:: Prices ,
6
5
sample:: { CardNameAmount , DivinationCardsSample , SampleData } ,
7
6
} ;
8
- use tauri:: { command, AppHandle , Manager , State } ;
7
+ use tauri:: { command, State } ;
9
8
10
9
use crate :: { js_result:: JSResult , prices:: AppCardPrices } ;
11
10
@@ -40,9 +39,11 @@ pub async fn sample_cards(
40
39
#[ command]
41
40
pub async fn merge (
42
41
samples : Vec < DivinationCardsSample > ,
43
- app_handle : AppHandle ,
44
- ) -> DivinationCardsSample {
45
- DivinationCardsSample :: merge ( Some ( app_handle. state :: < Prices > ( ) . inner ( ) . clone ( ) ) , & samples)
42
+ state : State < ' _ , Mutex < AppCardPrices > > ,
43
+ ) -> Result < DivinationCardsSample , ( ) > {
44
+ let mut guard = state. lock ( ) . await ;
45
+ let prices = guard. get_or_update ( & TradeLeague :: default ( ) ) . await ;
46
+ Ok ( DivinationCardsSample :: merge ( Some ( prices) , & samples) )
46
47
}
47
48
48
49
#[ command]
You can’t perform that action at this time.
0 commit comments