Skip to content

Commit

Permalink
fix: login link
Browse files Browse the repository at this point in the history
  • Loading branch information
IanKrieger committed Aug 28, 2023
1 parent 357ffb2 commit bc67cf6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/auth/hooks/mutations/useGetLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ export function useGetLink({ onError, onSuccess }: Options = {}) {
const [error, setError] = useState<string>();

const requestLink = useCallback(async (email: string) => {
if (email.trim() === "") {
setError("Please enter an email.");
return;
}

setError(undefined);
setLoading(true);
await getLink({ email })
.then(() => {
Expand Down
12 changes: 5 additions & 7 deletions src/auth/views/MagicLink.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from "react";

import { Link, Stack, TextField, Typography } from "@mui/material";
import { Link, TextField, Typography } from "@mui/material";
import { Link as RouterLink } from "react-router-dom";
import { useGetLink } from "auth/hooks/mutations/useGetLink";
import { LoadingButton } from "@mui/lab";
Expand All @@ -26,20 +26,18 @@ export function MagicLink() {
Click on the secure login link in the email to access your Brave Ads
account.
</Typography>
<Stack direction="row" spacing={0.75}>
<Typography variant="subtitle1">
Don&rsquo;t see the email? Check your spam folder or
</Typography>
<Typography variant="subtitle1">
Don&rsquo;t see the email? Check your spam folder or{" "}
<Link
sx={{ cursor: "pointer" }}
variant="subtitle1"
variant="inherit"
onClick={() => {
setRequested(false);
}}
>
try again.
</Link>
</Stack>
</Typography>
</AuthContainer>
);
}
Expand Down

0 comments on commit bc67cf6

Please sign in to comment.