Skip to content

Commit

Permalink
Remove validations
Browse files Browse the repository at this point in the history
  • Loading branch information
sperezm97 committed May 13, 2020
1 parent 9065383 commit 87c1058
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/component/ActiveAccount/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ActiveAccount = () => {
</View>
<View style={styles.containerAccount}>
<Text type="body">Actual Account</Text>
<Text type="bodyBold">{activeAccount.name}</Text>
<Text type="bodyBold">{activeAccount?.name}</Text>
</View>
</View>
<View>
Expand Down
4 changes: 2 additions & 2 deletions src/screens/Accounts/List/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const AccountsList = () => {
const accounts = useSelector(getAllAccounts);
const dispatch = useDispatch();

const onSelect = accountId => {
dispatch({ type: 'user/putActiveAccount', payload: accountId });
const onSelect = id => {
dispatch({ type: 'user/putActiveAccount', id });
};

const onOpenModal = () => navigation.dispatch(StackActions.push('AccountsCreate'));
Expand Down
2 changes: 1 addition & 1 deletion src/store/accounts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const accounts = createSlice({
},
extraReducers: {
'user/updateActiveAccount': (state, action) => {
state.activeAccount = state.data.find(ac => ac.id == action.payload);
state.activeAccount = state.data.find(ac => ac.id == action.payload.id);
},
'transactions/setNewTransaction': (state, action) => {
const isExpenses = action.payload.transactionTypeId === 'ks25ee53mu6Ja4V6VKPl';
Expand Down
1 change: 0 additions & 1 deletion src/store/transactions/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { formatDataFromFb, fbDateTime } from '../../utils';
import { getActiveAccountId, getUserId } from '../user/selectors';

function* fetchTransactions() {
yield take(['user/setData', 'accounts/setActiveAccountData']);
try {
const userId = yield select(getUserId);
const actualAccountId = yield select(getActiveAccountId);
Expand Down
2 changes: 1 addition & 1 deletion src/store/user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const user = createSlice({
},

updateActiveAccount: (state, action) => {
state.data.activeAccountId = action.payload;
state.data.activeAccountId = action.payload.id;
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/store/user/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function* fetchUser(payload) {
function* updateActiveAccount(payload) {
const userId = yield select(getUserId);
try {
yield call(userServices.update, userId, { active_account_id: payload });
yield call(userServices.update, userId, { active_account_id: payload.id });
yield put({ type: 'user/updateActiveAccount', payload });
} catch (error) {
console.log(error);
Expand Down

0 comments on commit 87c1058

Please sign in to comment.