Skip to content

Commit

Permalink
add API URL and fix code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
marshalljordan1 committed Oct 11, 2023
1 parent 153a6ae commit 1289576
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/components/PasswordReminderComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import cross from "../assets/img/cross.png";
import { connect } from "react-redux";
import { ChildComponentProps } from "../interfaces/interfaces";
import { RootState } from "../store/store";
import {
setEmail,
setEmailMessage,
} from "../store/reducers/apiCall/apiPostRegisterLogin";
import { useSelector, useDispatch } from "react-redux";
import { useSelector, useDispatch, connect } from "react-redux";

const PasswordReminderComponent = ({
setIsPasswordReminder,
}: ChildComponentProps & {
setEmail: (email: string) => void;
email: string;
}) => {
}: ChildComponentProps) => {
const email = useSelector((state: RootState) => state.apiPostRegister.email);
const emailMessage = useSelector(
(state: RootState) => state.apiPostRegister.emailMessage
Expand All @@ -28,13 +24,16 @@ const PasswordReminderComponent = ({
const handleFormSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
try {
const response = await fetch("", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ email }),
});
const response = await fetch(
"http://127.0.0.1:8000/api/forget-password",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ email }),
}
);

if (response.ok) {
dispatch(setEmailMessage("Password reminder email sent successfully."));
Expand Down

0 comments on commit 1289576

Please sign in to comment.