From b1c26ba992bc65a95478804c59bbecce73928bd0 Mon Sep 17 00:00:00 2001 From: keannu125 Date: Sun, 16 Apr 2023 13:52:19 +0800 Subject: [PATCH] Added registration functionality --- src/Routes/Register/Register.tsx | 98 +++++++++++++++++++------------- 1 file changed, 57 insertions(+), 41 deletions(-) diff --git a/src/Routes/Register/Register.tsx b/src/Routes/Register/Register.tsx index e2a3297..34497c1 100644 --- a/src/Routes/Register/Register.tsx +++ b/src/Routes/Register/Register.tsx @@ -1,56 +1,72 @@ -import * as React from 'react'; -import {View, Text, TextInput} from 'react-native'; -import styles from '../../styles'; -import Background from '../../Components/Background/Background'; -import { SafeAreaView } from 'react-native-safe-area-context'; +import * as React from "react"; +import { View, Text, TextInput } from "react-native"; +import styles from "../../styles"; +import Background from "../../Components/Background/Background"; +import { SafeAreaView } from "react-native-safe-area-context"; import { useState } from "react"; -import {TouchableOpacity} from "react-native"; +import { TouchableOpacity } from "react-native"; +import { UserRegister } from "../../Components/Api/Api"; export default function Register() { const [username, setUsername] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); + const [feedback, setFeedback] = useState(""); return ( - + - - Create an Account - - - + + Create an Account - - - - - - - REGISTER - - + + + + + + + + + { + setUsername(""); + setPassword(""); + console.log("heh"); + if (await UserRegister({ username, email, password })) { + setFeedback( + "Registration success. Please check your email address for activation" + ); + } else { + setFeedback("Invalid credentials specified"); + } + }} + style={styles.registerbtn} + > + REGISTER + + {feedback} + - ); }