File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ import { NodeOAuthClient } from '@atproto/oauth-client-node'
33import { createError , getQuery , sendRedirect } from 'h3'
44import { useOAuthStorage } from '#server/utils/atproto/storage'
55import { SLINGSHOT_HOST } from '#shared/utils/constants'
6- import { useServerSession } from '~~/server/utils/server-session'
6+ import { useServerSession } from '#server/utils/server-session'
7+ import type { PublicUserSession } from '#shared/schemas/publicUserSession'
78
89export default defineEventHandler ( async event => {
910 const config = useRuntimeConfig ( event )
@@ -53,15 +54,12 @@ export default defineEventHandler(async event => {
5354 `https://${ SLINGSHOT_HOST } /xrpc/com.bad-example.identity.resolveMiniDoc?identifier=${ agent . did } ` ,
5455 { headers : { 'User-Agent' : 'npmx' } } ,
5556 )
56- const miniDoc = await response . json ( )
57-
58- await session . update ( {
59- public : {
60- did : miniDoc . did ,
61- handle : miniDoc . handle ,
62- pds : miniDoc . pds ,
63- } ,
64- } )
57+ if ( response . ok ) {
58+ const miniDoc : PublicUserSession = await response . json ( )
59+ await session . update ( {
60+ public : miniDoc ,
61+ } )
62+ }
6563
6664 return sendRedirect ( event , '/' )
6765} )
You can’t perform that action at this time.
0 commit comments