Added a testing sign in method for Redux.
This commit is contained in:
36
components/signin.component.jsx
Normal file
36
components/signin.component.jsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import React from "react";
|
||||
import { View, Text, Button } from "react-native";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
|
||||
import {
|
||||
selectBodyshop,
|
||||
selectCurrentUser,
|
||||
} from "../redux/user/user.selectors";
|
||||
import { emailSignInStart } from "../redux/user/user.actions";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
currentUser: selectCurrentUser,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
emailSignInStart: (email, password) =>
|
||||
dispatch(emailSignInStart({ email, password })),
|
||||
});
|
||||
|
||||
export function SignIn({ bodyshop, currentUser, emailSignInStart }) {
|
||||
return (
|
||||
<View>
|
||||
<Text>The secondary view</Text>
|
||||
<Text>{JSON.stringify(currentUser)}</Text>
|
||||
<Button title="Testing." onPress={() => console.log("test")} />
|
||||
<Button
|
||||
title="Sign In"
|
||||
onPress={() => emailSignInStart("patrick@imex.dev", "patrick")}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(SignIn);
|
||||
Reference in New Issue
Block a user