Skip to content

Commit 5487886

Browse files
committed
fix(auth): return correct response
1 parent 46ed51f commit 5487886

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lambda/userJwt.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import {
1010
validateInput,
1111
type ValidInput,
1212
} from '@hello.nrfcloud.com/lambda-helpers/validateInput'
13-
import { Context, Email } from '@hello.nrfcloud.com/proto-map/api'
13+
import { Context, Email, type UserJWT } from '@hello.nrfcloud.com/proto-map/api'
1414
import middy from '@middy/core'
15-
import { Type } from '@sinclair/typebox'
15+
import { Type, type Static } from '@sinclair/typebox'
1616
import type {
1717
APIGatewayProxyEventV2,
1818
APIGatewayProxyResultV2,
@@ -62,11 +62,19 @@ const h = async (
6262
})
6363
}
6464

65+
const jwt = userJWT(email, jwtSettings)
66+
67+
const res: Static<typeof UserJWT> = {
68+
'@context': Context.userJWT.toString(),
69+
jwt,
70+
email,
71+
}
72+
6573
return aResponse(
6674
201,
6775
{
76+
...res,
6877
'@context': Context.userJWT,
69-
jwt: userJWT(email, jwtSettings),
7078
},
7179
60 * 60 * 24, // 24 hours
7280
)

0 commit comments

Comments
 (0)