|
|
|
@@ -6,9 +6,6 @@ import { setAccessToken } from "../state/UserSlice";
|
|
|
|
|
import { Center, Button, Text } from 'native-base';
|
|
|
|
|
import SigninForm from "../components/forms/signinform";
|
|
|
|
|
import SignupForm from "../components/forms/signupform";
|
|
|
|
|
import { Provider } from "react-redux";
|
|
|
|
|
import store from '../state/Store';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const hanldeSignin = async (username: string, password: string, apiSetter: (accessToken: string) => void): Promise<string> => {
|
|
|
|
|
try {
|
|
|
|
@@ -35,12 +32,11 @@ const AuthenticationView = () => {
|
|
|
|
|
const [mode, setMode] = React.useState("signin" as "signin" | "signup");
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Provider store={store}>
|
|
|
|
|
<Center style={{ flex: 1 }}>
|
|
|
|
|
<Text><Translate translationKey='welcome'/></Text>
|
|
|
|
|
{mode === "signin"
|
|
|
|
|
? <SigninForm onSubmit={(username, password) => hanldeSignin(username, password, (accessToken) => dispatch(setAccessToken(accessToken)))} />
|
|
|
|
|
: <SignupForm onSubmit={(username, password, email) => handleSignup(username, password, email, (accessToken) => dispatch(setAccessToken(accessToken)))} />
|
|
|
|
|
: <SignupForm onSubmit={(username, password, email) => handleSignup(username, password, email, (accessToken) => dispatch(setAccessToken(accessToken)))} />
|
|
|
|
|
}
|
|
|
|
|
{ mode ==="signin" && <Button variant="outline" marginTop={5} colorScheme="error" >{translate("forgottenPassword")}</Button> }
|
|
|
|
|
<Button variant='outline' marginTop={5} colorScheme='primary' onPress={() => setMode(mode === "signin" ? "signup" : "signin")}>
|
|
|
|
@@ -49,7 +45,6 @@ const AuthenticationView = () => {
|
|
|
|
|
</Text>
|
|
|
|
|
</Button>
|
|
|
|
|
</Center>
|
|
|
|
|
</Provider>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|