diff --git a/package.json b/package.json index d2b403d..0e46a1d 100644 --- a/package.json +++ b/package.json @@ -28,5 +28,9 @@ "eslint": "8.7.0", "eslint-config-next": "12.0.9", "typescript": "^4.5.5" + }, + "resolutions": { + "@types/react": "17.0.2", + "@types/react-dom": "17.0.2" } } diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index 7220338..6246dd6 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -65,7 +65,7 @@ export default NextAuth({ }, session: async function session({ session, token }) { - session.accessToken = token.accessToken; + session.accessToken = token.accessToken as string; try { const { data } = await axios.get(getFullUrlOrThrow("/website/auth/user/profile"), { headers: { diff --git a/types/next-auth.d.ts b/types/next-auth.d.ts new file mode 100644 index 0000000..a715087 --- /dev/null +++ b/types/next-auth.d.ts @@ -0,0 +1,11 @@ +import NextAuth from "next-auth"; + +declare module "next-auth" { + interface Session { + accessToken?: string; + } + interface User { + accessToken?: string; + refreshToken?: string; + } +} diff --git a/yarn.lock b/yarn.lock index b9602e1..1b4486a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -177,13 +177,19 @@ resolved "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz" integrity sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ== -"@types/react@*": - version "18.0.8" - resolved "https://registry.npmjs.org/@types/react/-/react-18.0.8.tgz" - integrity sha512-+j2hk9BzCOrrOSJASi5XiOyBbERk9jG5O73Ya4M0env5Ixi6vUNli4qy994AINcEF+1IEHISYFfIT4zwr++LKw== +"@types/react-dom@17.0.2": + version "17.0.2" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.2.tgz#35654cf6c49ae162d5bc90843d5437dc38008d43" + integrity sha512-Icd9KEgdnFfJs39KyRyr0jQ7EKhq8U6CcHRMGAS45fp5qgUvxL3ujUCfWFttUK2UErqZNj97t9gsVPNAqcwoCg== + dependencies: + "@types/react" "*" + +"@types/react@*", "@types/react@17.0.2": + version "17.0.2" + resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.2.tgz#3de24c4efef902dd9795a49c75f760cbe4f7a5a8" + integrity sha512-Xt40xQsrkdvjn1EyWe1Bc0dJLcil/9x2vAuW7ya+PuQip4UYUaXyhzWmAbwRsdMgwOFHpfp7/FFZebDU6Y8VHA== dependencies: "@types/prop-types" "*" - "@types/scheduler" "*" csstype "^3.0.2" "@types/react@17.0.38":