mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-14 11:15:02 -05:00
39 lines
947 B
TypeScript
39 lines
947 B
TypeScript
import { useHistory, useParams } from "react-router-dom";
|
|
|
|
import { useContext } from "preact/hooks";
|
|
|
|
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
|
|
|
import { Form } from "./Form";
|
|
|
|
export function FormSendReset() {
|
|
const client = useContext(AppContext);
|
|
|
|
return (
|
|
<Form
|
|
page="send_reset"
|
|
callback={async (data) => {
|
|
await client.req("POST", "/auth/send_reset", data);
|
|
}}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export function FormReset() {
|
|
const { token } = useParams<{ token: string }>();
|
|
const client = useContext(AppContext);
|
|
const history = useHistory();
|
|
|
|
return (
|
|
<Form
|
|
page="reset"
|
|
callback={async (data) => {
|
|
await client.req("POST", "/auth/reset", {
|
|
token,
|
|
...data,
|
|
});
|
|
history.push("/login");
|
|
}}
|
|
/>
|
|
);
|
|
}
|