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;
22
33use divi:: {
44 league:: TradeLeague ,
5- prices:: Prices ,
65 sample:: { CardNameAmount , DivinationCardsSample , SampleData } ,
76} ;
8- use tauri:: { command, AppHandle , Manager , State } ;
7+ use tauri:: { command, State } ;
98
109use crate :: { js_result:: JSResult , prices:: AppCardPrices } ;
1110
@@ -40,9 +39,11 @@ pub async fn sample_cards(
4039#[ command]
4140pub async fn merge (
4241 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) )
4647}
4748
4849#[ command]
You can’t perform that action at this time.
0 commit comments