Skip to content

Commit c84bc85

Browse files
authored
Merge pull request #10 from code-kern-ai/hotfix-min-version
Requires smaller next / react version
2 parents 48e4fb5 + c559f8c commit c84bc85

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
"eslint": "8.38.0",
2121
"eslint-config-next": "13.3.0",
2222
"express": "^4.18.2",
23-
"next": "13.3.0",
24-
"react": "18.2.0",
25-
"react-dom": "18.2.0",
23+
"next": "^12.2.0",
24+
"react": "^17.0.2",
25+
"react-dom": "^17.0.2",
2626
"react-toastify": "^9.1.2",
2727
"styled-components": "^5.3.9",
2828
"typescript": "5.0.4"
@@ -35,4 +35,4 @@
3535
"postcss": "^8.4.23",
3636
"tailwindcss": "^3.3.1"
3737
}
38-
}
38+
}

pages/login.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const Login: NextPage = () => {
103103
// If the previous handler did not catch the error it's most likely a form validation error
104104
if (err.response?.status === 400) {
105105
// Yup, it is!
106-
setInitialFlow(err.response?.data)
106+
setInitialFlow(err.response?.data as LoginFlow | undefined)
107107
return
108108
}
109109

pages/verify.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ const Verification: NextPage = () => {
8888
switch (err.response?.status) {
8989
case 400:
9090
// Status code 400 implies the form validation had an error
91-
setInitialFlow(err.response?.data)
91+
setInitialFlow(err.response?.data as VerificationFlow | undefined)
9292
return
9393
case 410:
94-
const newFlowID = err.response.data.use_flow_id
94+
const newFlowID = (err.response.data as any).use_flow_id
9595
router
9696
// On submission, add the flow ID to the URL but do not navigate. This prevents the user loosing
9797
// their data when they reload the page.

pkg/errors.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ export function handleGetFlowError<S>(
1010
resetFlow: Dispatch<SetStateAction<S | undefined>>,
1111
) {
1212
return async (err: AxiosError) => {
13-
switch (err.response?.data.error?.id) {
13+
switch ((err.response?.data as any).error?.id) {
1414
case "session_aal2_required":
1515
// 2FA is enabled and enforced, but user did not perform 2fa yet!
16-
window.location.href = err.response?.data.redirect_browser_to
16+
window.location.href = (err.response?.data as any).redirect_browser_to
1717
return
1818
case "session_already_available":
1919
// User is already signed in, let's redirect them home!
2020
await router.push("/welcome")
2121
return
2222
case "session_refresh_required":
2323
// We need to re-authenticate to perform this action
24-
window.location.href = err.response?.data.redirect_browser_to
24+
window.location.href = (err.response?.data as any).redirect_browser_to
2525
return
2626
case "self_service_flow_return_to_forbidden":
2727
// The flow expired, let's request a new one.
@@ -50,7 +50,7 @@ export function handleGetFlowError<S>(
5050
return
5151
case "browser_location_change_required":
5252
// Ory Kratos asked us to point the user to this URL.
53-
window.location.href = err.response.data.redirect_browser_to
53+
window.location.href = (err.response?.data as any).redirect_browser_to
5454
return
5555
}
5656

0 commit comments

Comments
 (0)