Skip to content

Commit

Permalink
feat: await cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRivers committed Oct 22, 2024
1 parent 52de96c commit 9be52c3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@
"typescript": "^5.1.3"
},
"peerDependencies": {
"next": "^12.2.5 || ^13 || ^14",
"react": "^18.1.0",
"react-dom": "^18.1.0"
"next": "^12.2.5 || ^13 || ^14 || ^15",
"react": "^18 || ^19",
"react-dom": "^18 || ^19"
},
"dependencies": {
"@babel/preset-env": "^7.25.4",
Expand Down
17 changes: 10 additions & 7 deletions src/utils/appRouter/setVerifierCookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ import {config} from '../../config/index';
import {cookies} from 'next/headers';
import {GLOBAL_COOKIE_OPTIONS} from '../../session/sessionManager';

export const setVerifierCookie = (state, code_verifier, options) => {
cookies().set({
name: `${config.SESSION_PREFIX}-${state}`,
value: JSON.stringify({code_verifier, options}),
maxAge: 60 * 15,
...GLOBAL_COOKIE_OPTIONS
});
export const setVerifierCookie = async (state, code_verifier, options) => {
const set = async () => {
(await cookies()).set({
name: `${config.SESSION_PREFIX}-${state}`,
value: JSON.stringify({code_verifier, options}),
maxAge: 60 * 15,
...GLOBAL_COOKIE_OPTIONS
});
}
await set();
};

0 comments on commit 9be52c3

Please sign in to comment.