Fakultas Ilmu Komputer UI

Commit 6d2c6e0f authored by Bagus Prabowo's avatar Bagus Prabowo
Browse files

Merge branch 'change-password-screen-fix' into 'dev'

Fix: Change password screen fix

See merge request !53
parents 744e6e1c 931b32d8
......@@ -10,20 +10,24 @@ import Colors from "../constants/Colors";
import { ProfileStackParamList } from "../types/navigation";
export default function SuccessChangePasswordScreen() {
const nav = useNavigation<NativeStackNavigationProp<ProfileStackParamList>>();
const nav = useNavigation();
return (
<View style={styles.container}>
<Spacer variant={"xl"} />
<Text style={styles.title}>Ganti Password Berhasil</Text>
<View>
<Text style={styles.title}>Ganti Password Berhasil</Text>
</View>
<Spacer variant={"xl"} />
<Text style={styles.paragraph}>
Anda sudah bisa masuk menggunakan password baru anda.
</Text>
<View>
<Text style={styles.paragraph}>
Anda sudah bisa masuk menggunakan password baru anda.
</Text>
</View>
<Spacer variant={"xl"} />
<View style={styles.buttonContainer}>
<MainButton
text={"Kembali"}
onPress={() => nav.goBack()}
onPress={() => nav.navigate("AccountSettings")}
colors={"Secondary"}
/>
</View>
......
......@@ -6,9 +6,15 @@ import MainButton from "../../components/button/MainButton";
import IconForm from "../../components/Forms/IconForm";
import Spacer from "../../components/Spacer/Spacer";
import Colors from "../../constants/Colors";
import { RootTabScreenProps } from "../../types/navigation";
import { useDispatch } from "react-redux";
import { changePassword } from "../../redux/user/actions";
const ChangePasswordScreen = () => {
const ChangePasswordScreen = ({
navigation,
}: RootTabScreenProps<"Profile">) => {
const nav = useNavigation();
const dispatch = useDispatch();
const [oldPassword, onChangeOldPassword] = useState("");
const [newPassword, onChangeNewPassword] = useState("");
......@@ -28,8 +34,12 @@ const ChangePasswordScreen = () => {
</View>
<Spacer variant={"m"} />
<View style={styles.componentWrapper}>
<TouchableOpacity>
<Text style={styles.link}>Lupa password lama anda</Text>
<TouchableOpacity
onPress={() => {
nav.navigate("Auth", { screen: "InputForgotPassword" });
}}
>
<Text style={styles.link}>Lupa password lama anda?</Text>
</TouchableOpacity>
</View>
<Spacer variant={"l"} />
......@@ -49,6 +59,9 @@ const ChangePasswordScreen = () => {
text={"Ganti Password"}
onPress={() => {
Keyboard.dismiss();
dispatch(changePassword(oldPassword, newPassword));
onChangeOldPassword("");
onChangeNewPassword("");
nav.navigate("SuccessChangePassword");
}}
colors={"Secondary"}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment