Skip to content

Commit b4d06af

Browse files
committed
refactor(usePayloadSession): Remove unnecessary null check
1 parent b76df1a commit b4d06af

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

packages/payload-authjs/src/payload/session/usePayloadSession.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,5 @@ import { Context, type SessionContext } from "./PayloadSessionProvider";
88
* Client side hook to retrieve the session from the context provider (PayloadSessionProvider)
99
*/
1010
export const usePayloadSession = <TSlug extends CollectionSlug = "users">() => {
11-
const result = use<SessionContext<TSlug>>(Context);
12-
13-
if (!result) {
14-
throw new Error("usePayloadSession must be used within a PayloadSessionProvider");
15-
}
16-
17-
return result;
11+
return use<SessionContext<TSlug>>(Context);
1812
};

0 commit comments

Comments
 (0)