-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: session always being null in history
Next Auth uses cookies. Request from a server component strip cookies. So I moved the db call into the server component. Helpful link: nextauthjs/next-auth#7423 (comment)
- Loading branch information
1 parent
f88720b
commit f9c3411
Showing
8 changed files
with
27 additions
and
60 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { db } from '~/server/db' | ||
import { TypingSessionRepository } from '~/server/repositories/typingSession.repository' | ||
import { TypingSessionLog, getTypingSessionLog } from './log' | ||
import { BookOverview, getBookOverview } from './overview' | ||
|
||
export async function getHistory( | ||
userId: string, | ||
): Promise<{ log: TypingSessionLog[]; overview: BookOverview[] }> { | ||
const typingSessionRepository = new TypingSessionRepository(db) | ||
|
||
const typingSessions = await typingSessionRepository.getMany({ | ||
userId, | ||
}) | ||
|
||
const overview = getBookOverview(typingSessions) | ||
|
||
const log = typingSessions | ||
.map(a => getTypingSessionLog(a)) | ||
.filter(a => a.numberOfVersesTyped > 0) | ||
return { overview, log } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters