Skip to content

Commit bb65bfa

Browse files
committed
going try cutting down the calls to refresh sessions
1 parent defcb83 commit bb65bfa

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

server/api/auth/session.get.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { PublicUserSessionSchema } from '#shared/schemas/publicUserSession'
22
import { safeParse } from 'valibot'
33

4-
export default eventHandlerWithOAuthSession(async (event, oAuthSession, serverSession) => {
4+
export default defineEventHandler(async event => {
5+
const serverSession = await useServerSession(event)
56
const result = safeParse(PublicUserSessionSchema, serverSession.data.public)
67
if (!result.success) {
78
return null

server/utils/atproto/oauth-session-store.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ export class OAuthSessionStore implements NodeSavedSessionStore {
1717

1818
async set(_key: string, val: NodeSavedSession) {
1919
// We are ignoring the key since the mapping is already done in the session
20-
console.log('oauth session set', val)
21-
await this.session.update({
22-
oauthSession: val,
23-
})
20+
try {
21+
await this.session.update({
22+
oauthSession: val,
23+
})
24+
} catch (error) {
25+
console.error('Error setting OAuth session:', error)
26+
}
2427
}
2528

2629
async del() {

0 commit comments

Comments
 (0)