Skip to content

Commit 6c2cb93

Browse files
TmmcmastersTimothy McMasters
andauthored
fix: explicit Return Type on getUserSession (#379)
Co-authored-by: Timothy McMasters <[email protected]>
1 parent 61dd7ba commit 6c2cb93

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/runtime/server/utils/session.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const sessionHooks = createHooks<SessionHooks>()
2727
* @param event The Request (h3) event
2828
* @returns The user session
2929
*/
30-
export async function getUserSession(event: UseSessionEvent) {
30+
export async function getUserSession(event: UseSessionEvent): Promise<UserSession> {
3131
const session = await _useSession(event)
3232
return {
3333
id: session.id,
@@ -40,7 +40,7 @@ export async function getUserSession(event: UseSessionEvent) {
4040
* @param data User session data, please only store public information since it can be decoded with API calls
4141
* @see https://github.com/atinux/nuxt-auth-utils
4242
*/
43-
export async function setUserSession(event: H3Event, data: UserSession, config?: Partial<SessionConfig>) {
43+
export async function setUserSession(event: H3Event, data: UserSession, config?: Partial<SessionConfig>): Promise<UserSession> {
4444
const session = await _useSession(event, config)
4545

4646
await session.update(defu(data, session.data))
@@ -53,7 +53,7 @@ export async function setUserSession(event: H3Event, data: UserSession, config?:
5353
* @param event The Request (h3) event
5454
* @param data User session data, please only store public information since it can be decoded with API calls
5555
*/
56-
export async function replaceUserSession(event: H3Event, data: UserSession, config?: Partial<SessionConfig>) {
56+
export async function replaceUserSession(event: H3Event, data: UserSession, config?: Partial<SessionConfig>): Promise<UserSession> {
5757
const session = await _useSession(event, config)
5858

5959
await session.clear()
@@ -67,7 +67,7 @@ export async function replaceUserSession(event: H3Event, data: UserSession, conf
6767
* @param event The Request (h3) event
6868
* @returns true if the session was cleared
6969
*/
70-
export async function clearUserSession(event: H3Event, config?: Partial<SessionConfig>) {
70+
export async function clearUserSession(event: H3Event, config?: Partial<SessionConfig>): Promise<boolean> {
7171
const session = await _useSession(event, config)
7272

7373
await sessionHooks.callHookParallel('clear', session.data, event)

0 commit comments

Comments
 (0)