Skip to content

Commit

Permalink
fix login
Browse files Browse the repository at this point in the history
  • Loading branch information
arily committed Mar 5, 2024
1 parent a610d07 commit 0cde2fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/server/backend/$base/server/session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export abstract class SessionProvider<TSession extends Session<string>> {
...data,
lastSeen: new Date(),
} as TSession

await this.store.set(sessionId, _session)
return sessionId
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Buffer } from 'node:buffer'
import type { Buffer } from 'node:buffer'
import type { Document } from 'bson'
import * as BSON from 'bson'
import { commandOptions, type createClient } from 'redis'
Expand Down Expand Up @@ -50,8 +50,9 @@ export class RedisSessionStore<TDoc extends Document & Session<any>> extends Ses
}

async #set(key: KeyOf<TDoc>, value: TDoc) {
const stream = BSON.serialize(value)
await this.#redis.set(key, Buffer.from(stream.buffer), { EX: sessionConfig.expire / 1000 })
const stream = BSON.serialize(value, { ignoreUndefined: true })

await this.#redis.set(key, stream as Buffer, { EX: sessionConfig.expire / 1000 })
return key
}

Expand Down

0 comments on commit 0cde2fe

Please sign in to comment.