|
|
@@ -31,12 +31,15 @@ module.exports = {
|
|
31
|
31
|
const hashedSessionToken = request.payload
|
|
32
|
32
|
const { userService, profileService } = request.server.services()
|
|
33
|
33
|
try {
|
|
34
|
|
- const validatedSessionToken =
|
|
|
34
|
+ const validatedSessionInfo =
|
|
35
|
35
|
userService.validateSession(hashedSessionToken)
|
|
36
|
|
- if(validatedSessionToken?.email) throw new Error(`Could not validate token based on payload: ${request.payload}`)
|
|
37
|
|
-
|
|
|
36
|
+ if (validatedSessionInfo?.email)
|
|
|
37
|
+ throw new Error(
|
|
|
38
|
+ `Could not validate token based on payload: ${request.payload}`,
|
|
|
39
|
+ )
|
|
|
40
|
+
|
|
38
|
41
|
const user = await userService.findByUserEmail(
|
|
39
|
|
- validatedSessionToken.email,
|
|
|
42
|
+ validatedSessionInfo.email,
|
|
40
|
43
|
)
|
|
41
|
44
|
const type = user.is_poster === 1 ? 'poster' : 'seeker'
|
|
42
|
45
|
const profiles = await profileService.getCompleteProfilesFor(
|
|
|
@@ -49,7 +52,7 @@ module.exports = {
|
|
49
|
52
|
ok: true,
|
|
50
|
53
|
handler: pluginConfig.handlerType,
|
|
51
|
54
|
data: {
|
|
52
|
|
- ...validatedSessionToken,
|
|
|
55
|
+ ...validatedSessionInfo,
|
|
53
|
56
|
profileId: profileId,
|
|
54
|
57
|
},
|
|
55
|
58
|
}
|