Skip to content

Commit 4ba0909

Browse files
committed
fix: import location
1 parent 9ff73d8 commit 4ba0909

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

src/authMiddleware/authMiddleware.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { getSplitCookies } from "../utils/cookies/getSplitSerializedCookies";
1010
import { getIdToken } from "../utils/getIdToken";
1111
import { OAuth2CodeExchangeResponse } from "@kinde-oss/kinde-typescript-sdk";
1212
import { copyCookiesToRequest } from "../utils/copyCookiesToRequest";
13-
import { getStandardCookieOptions } from "src/utils/cookies/getStandardCookieOptions";
13+
import { getStandardCookieOptions } from "../utils/cookies/getStandardCookieOptions";
1414

1515
const handleMiddleware = async (req, options, onSuccess) => {
1616
const { pathname } = req.nextUrl;
@@ -136,7 +136,11 @@ const handleMiddleware = async (req, options, onSuccess) => {
136136
resp.cookies.set(cookie.name, cookie.value, cookie.options);
137137
});
138138

139-
resp.cookies.set("refresh_token", refreshResponse.refresh_token, getStandardCookieOptions());
139+
resp.cookies.set(
140+
"refresh_token",
141+
refreshResponse.refresh_token,
142+
getStandardCookieOptions(),
143+
);
140144

141145
// copy the cookies from the response to the request
142146
// in Next versions prior to 14.2.8, the cookies function
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { MAX_COOKIE_LENGTH } from '../constants';
2-
import { splitString } from '../splitString';
3-
import { getStandardCookieOptions } from 'src/utils/cookies/getStandardCookieOptions';
1+
import { MAX_COOKIE_LENGTH } from "../constants";
2+
import { splitString } from "../splitString";
3+
import { getStandardCookieOptions } from "../../utils/cookies/getStandardCookieOptions";
44

55
export const getSplitCookies = (cookieName: string, cookieValue: string) => {
66
return splitString(cookieValue, MAX_COOKIE_LENGTH).map((value, index) => {
77
return {
8-
name: cookieName + (index === 0 ? '' : index),
8+
name: cookieName + (index === 0 ? "" : index),
99
value: value,
10-
options: getStandardCookieOptions()
10+
options: getStandardCookieOptions(),
1111
};
1212
});
1313
};

src/utils/cookies/getStandardCookieOptions.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
import { ResponseCookie } from 'next/dist/compiled/@edge-runtime/cookies';
2-
import { config } from 'src/config';
3-
import { GLOBAL_COOKIE_OPTIONS, TWENTY_NINE_DAYS } from 'src/utils/constants';
1+
import { ResponseCookie } from "next/dist/compiled/@edge-runtime/cookies";
2+
import { config } from "../../config";
3+
import { GLOBAL_COOKIE_OPTIONS, TWENTY_NINE_DAYS } from "../../utils/constants";
44

5-
export const getStandardCookieOptions = (): Omit<ResponseCookie, 'name' | 'value'> => {
5+
export const getStandardCookieOptions = (): Omit<
6+
ResponseCookie,
7+
"name" | "value"
8+
> => {
69
return {
710
maxAge: TWENTY_NINE_DAYS,
811
domain: config.cookieDomain ? config.cookieDomain : undefined,

0 commit comments

Comments
 (0)