Esempio n. 1
0
 return (dispatch: Redux.Dispatch<any, IState>, getState: () => IState) => {
     dispatch(endLoading(scope));
     if (message) {
         dispatch(addError(scope, message));
     } else {
         dispatch(addError(scope, "Some error"));
     }
 };
Esempio n. 2
0
 .then(response => {
     const answer = response.data as any;
     clientAccess.cache.reset();
     if (!answer || !answer.wallets) {
         throw Error("Server returns empty response");
     } else {
         dispatch(endLoading("wallets"));
         dispatch(walletsLoadSuccess(answer.wallets as any));
     }
 })
Esempio n. 3
0
 .then(response => {
     const answer = (response.data as any);
     clientAccess.cache.reset();
     if (!answer) {
         throw Error("Server returns empty response");
     } else {
         dispatch(endLoading("wallets-delete"));
         dispatch(walletDeleteSuccess(id));
     }
 })
Esempio n. 4
0
 .then((response: any) => {
     if (!response.data) {
         throw Error("Server returns empty response");
     } else {
         clientAccess.cache.reset();
         const {token, expiredIn} = response.data.access;
         dispatch(authUpdateAccessToken({token, expiredIn}));
         dispatch(endLoading("auth"));
     }
 })
Esempio n. 5
0
 .then((response: any) => {
     if (!response.data) {
         throw Error("Server returns empty response");
     } else {
         dispatch(endLoading("auth"));
         apolloClient.cache.reset();
         const {accessToken, refreshToken, me} = response.data[name];
         dispatch(authSuccess(accessToken, refreshToken, me));
     }
 }).catch((err: any) => {
Esempio n. 6
0
 .then(response => {
     const answer = (response.data as any);
     clientAccess.cache.reset();
     if (!answer) {
         throw Error("Server returns empty response");
     } else {
         dispatch(endLoading("transactions"));
         dispatch(removeTransactionFromSelectedWallet(id));
         dispatch(transactionDeleteSuccess(id));
     }
 })
Esempio n. 7
0
 .then(response => {
     dispatch(endLoading("transactions"));
     if (!response.data) {
         throw Error("Server returns empty response");
     } else {
         const w = (response.data.createTransaction as ITransactionCreateMutationResponse);
         const transaction = {
             ...w,
         };
         dispatch(transactionCreationSuccess(transaction as any));
     }
 })
Esempio n. 8
0
 .then(response => {
     dispatch(endLoading("wallet"));
     if (!response.data) {
         throw Error("Server returns empty response");
     } else {
         const w = (response.data.createWallet as IWalletCreateMutationResponse);
         const wallet = {
             ...w,
             ownerId: (w.owner.id as string)
         };
         dispatch(walletCreationSuccess(wallet as any));
     }
 })