Skip to content

Commit afe4094

Browse files
committed
msw: Implement getSession() helper fn
1 parent 952ca9d commit afe4094

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { db } from '../index.js';
2+
3+
export function getSession() {
4+
let session = db.mswSession.findFirst({});
5+
if (!session) {
6+
return {};
7+
}
8+
9+
let user = session.user;
10+
11+
return { session, user };
12+
}

0 commit comments

Comments
 (0)