@@ -10,13 +10,13 @@ import {
1010 XCircle ,
1111} from 'react-feather' ;
1212import { useNavigate } from 'react-router-dom' ;
13- import { create } from 'zustand' ;
1413import { Alert } from '@/components/Alert' ;
1514import { LoadingSpinner } from '@/components/LoadingSpinner' ;
1615import { Stepper } from '@/components/Stepper' ;
1716import { Button } from '@/components/ui/button' ;
1817import { toast } from '@/components/ui/use-toast' ;
1918import { getDataProtectorCoreClient } from '@/externals/iexecSdkClient' ;
19+ import useStatusStore from '@/stores/useStatus.store' ;
2020import useUserStore from '@/stores/useUser.store' ;
2121import { getUserFriendlyStatues } from '@/utils/getUserFriendlyStatues' ;
2222import { cn } from '@/utils/style.utils' ;
@@ -40,38 +40,6 @@ const COLOR_CLASSES: {
4040 } ,
4141} ;
4242
43- type OneStatus = {
44- title : string ;
45- isDone ?: boolean ;
46- isError ?: boolean ;
47- payload ?: Record < string , string > ;
48- } ;
49-
50- type StatusState = {
51- statuses : Record <
52- string ,
53- { isDone ?: boolean ; isError ?: boolean ; payload ?: Record < string , string > }
54- > ;
55- addOrUpdateStatusToStore : ( status : OneStatus ) => void ;
56- resetStatuses : ( ) => void ;
57- } ;
58-
59- const useStatusStore = create < StatusState > ( ( set ) => ( {
60- statuses : { } ,
61- addOrUpdateStatusToStore : ( status ) =>
62- set ( ( state ) => ( {
63- statuses : {
64- ...state . statuses ,
65- [ status . title ] : {
66- isDone : status . isDone ,
67- isError : status . isError ?? false ,
68- payload : status . payload ,
69- } ,
70- } ,
71- } ) ) ,
72- resetStatuses : ( ) => set ( { statuses : { } } ) ,
73- } ) ) ;
74-
7543export default function AddProtectedData ( ) {
7644 const { address : userAddress } = useUserStore ( ) ;
7745 const { statuses, addOrUpdateStatusToStore, resetStatuses } =
0 commit comments