Skip to content

Commit 446cbb1

Browse files
authored
refactor: replace deprecated url.parse api usage (#14980)
Replaces `URL.parse()` usage which is now deprecated with `new URL()`. Fixes #14978
1 parent 2117dbf commit 446cbb1

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

packages/payload/src/auth/operations/refresh.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import url from 'url'
2-
31
import type { Collection } from '../../collections/config/types.js'
42
import type { Document, PayloadRequest } from '../../types/index.js'
53

@@ -64,8 +62,9 @@ export const refreshOperation = async (incomingArgs: Arguments): Promise<Result>
6462
throw new Forbidden(args.req.t)
6563
}
6664

67-
const parsedURL = url.parse(args.req.url!)
68-
const isGraphQL = parsedURL.pathname === config.routes.graphQL
65+
const pathname = new URL(args.req.url!).pathname
66+
67+
const isGraphQL = pathname === config.routes.graphQL
6968

7069
let user = await req.payload.db.findOne<any>({
7170
collection: collectionConfig.slug,

0 commit comments

Comments
 (0)