forked from abner/for-legacy-web
Port modal / popover context.
This commit is contained in:
@@ -11,7 +11,7 @@ export interface CaptchaProps {
|
||||
}
|
||||
|
||||
export function CaptchaBlock(props: CaptchaProps) {
|
||||
const { client } = useContext(AppContext);
|
||||
const client = useContext(AppContext);
|
||||
|
||||
useEffect(() => {
|
||||
if (!client.configuration?.features.captcha.enabled) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { MailProvider } from "./MailProvider";
|
||||
import { useContext, useState } from "preact/hooks";
|
||||
import { CheckCircle, Mail } from "@styled-icons/feather";
|
||||
import { CaptchaBlock, CaptchaProps } from "./CaptchaBlock";
|
||||
import { takeError } from "../../../context/revoltjs/error";
|
||||
import { takeError } from "../../../context/revoltjs/util";
|
||||
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
||||
|
||||
import FormField from "../FormField";
|
||||
@@ -34,7 +34,7 @@ function getInviteCode() {
|
||||
}
|
||||
|
||||
export function Form({ page, callback }: Props) {
|
||||
const { client } = useContext(AppContext);
|
||||
const client = useContext(AppContext);
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [success, setSuccess] = useState<string | undefined>(undefined);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useContext } from "preact/hooks";
|
||||
import { Form } from "./Form";
|
||||
|
||||
export function FormCreate() {
|
||||
const { client } = useContext(AppContext);
|
||||
const client = useContext(AppContext);
|
||||
|
||||
return (
|
||||
<Form
|
||||
|
||||
@@ -2,10 +2,10 @@ import { Form } from "./Form";
|
||||
import { useContext } from "preact/hooks";
|
||||
import { useHistory } from "react-router-dom";
|
||||
import { deviceDetect } from "react-device-detect";
|
||||
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
||||
import { OperationsContext } from "../../../context/revoltjs/RevoltClient";
|
||||
|
||||
export function FormLogin() {
|
||||
const { operations } = useContext(AppContext);
|
||||
const { login } = useContext(OperationsContext);
|
||||
const history = useHistory();
|
||||
|
||||
return (
|
||||
@@ -21,7 +21,7 @@ export function FormLogin() {
|
||||
device_name = "Unknown Device";
|
||||
}
|
||||
|
||||
await operations.login({ ...data, device_name });
|
||||
await login({ ...data, device_name });
|
||||
history.push("/");
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useContext } from "preact/hooks";
|
||||
import { Form } from "./Form";
|
||||
|
||||
export function FormResend() {
|
||||
const { client } = useContext(AppContext);
|
||||
const client = useContext(AppContext);
|
||||
|
||||
return (
|
||||
<Form
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useHistory, useParams } from "react-router-dom";
|
||||
import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
||||
|
||||
export function FormSendReset() {
|
||||
const { client } = useContext(AppContext);
|
||||
const client = useContext(AppContext);
|
||||
|
||||
return (
|
||||
<Form
|
||||
@@ -18,7 +18,7 @@ export function FormSendReset() {
|
||||
|
||||
export function FormReset() {
|
||||
const { token } = useParams<{ token: string }>();
|
||||
const { client } = useContext(AppContext);
|
||||
const client = useContext(AppContext);
|
||||
const history = useHistory();
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user