diff --git a/src/routes/Activation/Activation.tsx b/src/routes/Activation/Activation.tsx index 562b241..d9d7b9d 100644 --- a/src/routes/Activation/Activation.tsx +++ b/src/routes/Activation/Activation.tsx @@ -3,6 +3,8 @@ import styles, { colors } from "../../styles"; import { View, Text, ActivityIndicator } from "react-native"; import AnimatedContainer from "../../components/AnimatedContainer/AnimatedContainer"; import { useRoute } from "@react-navigation/native"; +import { useEffect, useState } from "react"; +import { UserActivate } from "../../components/Api/Api"; interface ActivationRouteParams { uid?: string; @@ -11,17 +13,47 @@ interface ActivationRouteParams { export default function Activation() { const route = useRoute(); - const { uid, token } = route.params as ActivationRouteParams; + const { uid, token } = (route.params as ActivationRouteParams) || ""; + + const [state, setState] = useState( + "Activating with UID " + uid + " and Token " + token + ); + const [loading, setLoading] = useState(true); + async function activate() { + if (await UserActivate({ uid: String(uid), token: String(token) })) { + setTimeout(() => { + setState("Activation successful!"); + }, 1000); + } else { + setTimeout(() => { + setState("Activation unsuccessful\nPlease contact support"); + }, 1000); + } + setLoading(false); + } + useEffect(() => { + activate(); + }, []); return ( + Activation - - - Activating {uid ? `with UID: ${uid}` : ""}{" "} - {token ? `and Token: ${token}` : ""} - + + {state} );