@@ -10,6 +10,8 @@ let unlistenGetTokenFailure: UnlistenFn | null = null;
1010let unlistenGetTokenSuccess : UnlistenFn | null = null ;
1111let unlistenFavoriteSuccess : UnlistenFn | null = null ;
1212let unlistenFavoriteFailed : UnlistenFn | null = null ;
13+ let unlistenUnfavoriteSuccess : UnlistenFn | null = null ;
14+ let unlistenUnfavoriteFailed : UnlistenFn | null = null ;
1315let unlistenGetAssetDetailSuccess : UnlistenFn | null = null ;
1416let unlistenGetAssetDetailFailed : UnlistenFn | null = null ;
1517let unlistenRenameSuccess : UnlistenFn | null = null ;
@@ -23,13 +25,17 @@ function releaseTauriEventListeners() {
2325 unlistenFavoriteSuccess ?.( ) ;
2426 unlistenFavoriteFailed ?.( ) ;
2527 unlistenGetTokenFailure ?.( ) ;
28+ unlistenUnfavoriteSuccess ?.( ) ;
29+ unlistenUnfavoriteFailed ?.( ) ;
2630 unlistenGetAssetDetailSuccess ?.( ) ;
2731 unlistenGetAssetDetailFailed ?.( ) ;
2832 unlistenRenameSuccess ?.( ) ;
2933 unlistenRenameError ?.( ) ;
3034 unlistenGetTokenFailure = null ;
3135 unlistenGetTokenSuccess = null ;
3236 unlistenFavoriteSuccess = null ;
37+ unlistenUnfavoriteFailed = null ;
38+ unlistenUnfavoriteSuccess = null ;
3339 unlistenFavoriteFailed = null ;
3440 unlistenGetAssetDetailSuccess = null ;
3541 unlistenGetAssetDetailFailed = null ;
@@ -351,6 +357,13 @@ export const useAssetAction = () => {
351357 }
352358
353359 const payload = event . payload as eventPayload ;
360+ if ( payload . status === "success" ) {
361+ toast . add ( {
362+ title : t ( "ContextMenu.FavoriteSuccess" ) ,
363+ color : "primary" ,
364+ icon : "line-md:check-all"
365+ } ) ;
366+ }
354367 } ) ;
355368
356369 unlistenFavoriteFailed = await useTauriEventListen ( "set-favorite-failure" , ( event ) => {
@@ -359,6 +372,43 @@ export const useAssetAction = () => {
359372 }
360373
361374 const payload = event . payload as eventPayload ;
375+ if ( payload . status === "failed" ) {
376+ toast . add ( {
377+ title : t ( "ContextMenu.FavoriteFailed" ) ,
378+ color : "error" ,
379+ icon : "line-md:close-circle"
380+ } ) ;
381+ }
382+ } ) ;
383+
384+ unlistenUnfavoriteSuccess = await useTauriEventListen ( "unfavorite-success" , ( event ) => {
385+ interface eventPayload {
386+ status : string ;
387+ }
388+
389+ const payload = event . payload as eventPayload ;
390+ if ( payload . status === "success" ) {
391+ toast . add ( {
392+ title : t ( "ContextMenu.UnfavoriteSuccess" ) ,
393+ color : "primary" ,
394+ icon : "line-md:check-all"
395+ } ) ;
396+ }
397+ } ) ;
398+
399+ unlistenUnfavoriteFailed = await useTauriEventListen ( "unfavorite-failure" , ( event ) => {
400+ interface eventPayload {
401+ status : string ;
402+ }
403+
404+ const payload = event . payload as eventPayload ;
405+ if ( payload . status === "failed" ) {
406+ toast . add ( {
407+ title : t ( "ContextMenu.UnfavoriteFailed" ) ,
408+ color : "error" ,
409+ icon : "line-md:close-circle"
410+ } ) ;
411+ }
362412 } ) ;
363413
364414 unlistenGetAssetDetailSuccess = await useTauriEventListen ( "get-asset-detail-success" , ( event ) => {
0 commit comments