tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
29
pulls
pipelines
don't use swr in loginform
awarm.space
9 months ago
67519d4b
c9aaa55f
+3
-5
1 changed file
expand all
collapse all
unified
split
app
login
LoginForm.tsx
+3
-5
app/login/LoginForm.tsx
···
11
11
import { Input } from "components/Input";
12
12
import { useSmoker, useToaster } from "components/Toast";
13
13
import React, { useState } from "react";
14
14
-
import useSWR, { mutate } from "swr";
14
14
+
import { mutate } from "swr";
15
15
16
16
export default function LoginForm() {
17
17
type FormState =
···
29
29
const [formState, setFormState] = useState<FormState>({
30
30
stage: "email",
31
31
email: "",
32
32
-
});
33
33
-
34
34
-
let { data: localLeaflets } = useSWR("leaflets", () => getHomeDocs(), {
35
35
-
fallbackData: [],
36
32
});
37
33
38
34
const handleSubmitEmail = async (e: React.FormEvent) => {
···
69
65
},
70
66
});
71
67
} else {
68
68
+
let localLeaflets = getHomeDocs();
69
69
+
72
70
await loginWithEmailToken(localLeaflets.filter((l) => !l.hidden));
73
71
mutate("identity");
74
72
toaster({