Skip to content

Commit 61af313

Browse files
committed
Fix up additional floating promise cases
1 parent 8b6b052 commit 61af313

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

site/components/SignIn/SignInForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export const SignInForm: React.FC<SignInProps> = ({
8888
await loginHandler(email, password)
8989
// Tell SWR to invalidate the cache for the user endpoint
9090
await mutate("/api/v2/user")
91-
router.push("/")
91+
await router.push("/")
9292
} catch (err) {
9393
helpers.setFieldError("password", "The username or password is incorrect.")
9494
}

site/contexts/UserContext.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ export const useUser = (redirectOnError = false): UserContext => {
2323
const requestError = ctx.error
2424
useEffect(() => {
2525
if (redirectOnError && requestError) {
26-
router.push({
26+
// 'void' means we are ignoring handling the promise returned
27+
// from router.push (and lets the linter know we're OK with that!)
28+
void router.push({
2729
pathname: "/login",
2830
query: {
2931
redirect: router.asPath,

0 commit comments

Comments
 (0)