Unverified Commit 08f06e7a authored by Rishabh Poddar's avatar Rishabh Poddar Committed by GitHub

Update SuperTokens dependency version in with-supertokens example (#27110)

- Updates supertokens-auth-react to v0.15.0
- In the supertokens example, handles 401 session expired automatically (via the lib).
parent 1bcc9234
...@@ -11,8 +11,11 @@ ...@@ -11,8 +11,11 @@
"next": "latest", "next": "latest",
"react": "17.0.1", "react": "17.0.1",
"react-dom": "17.0.1", "react-dom": "17.0.1",
"supertokens-auth-react": "^0.14.0", "supertokens-auth-react": "^0.15.0",
"supertokens-node": "^6.0.0" "supertokens-node": "^6.0.0"
}, },
"license": "MIT" "license": "MIT",
"devDependencies": {
"eslint-config-next": "11.0.1"
}
} }
...@@ -47,9 +47,7 @@ function ProtectedPage({ userId }) { ...@@ -47,9 +47,7 @@ function ProtectedPage({ userId }) {
async function fetchUserData() { async function fetchUserData() {
const res = await fetch('/api/user') const res = await fetch('/api/user')
if (res.status === 401) { if (res.status === 200) {
ThirdPartyEmailPassword.redirectToAuth()
} else {
const json = await res.json() const json = await res.json()
alert(JSON.stringify(json)) alert(JSON.stringify(json))
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment