Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
snip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
irp
snip
Commits
c4f37937
Commit
c4f37937
authored
4 months ago
by
Sebastian Mohr
Browse files
Options
Downloads
Patches
Plain Diff
Fixed small error when user does not exist in database but
session is set.
parent
d8a2b7d3
No related branches found
No related tags found
1 merge request
!19
v1.9.0
Pipeline
#544572
passed
4 months ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
apps/email/package.json
+1
-1
1 addition, 1 deletion
apps/email/package.json
apps/fullstack/app/api/account/user/route.ts
+24
-14
24 additions, 14 deletions
apps/fullstack/app/api/account/user/route.ts
apps/images/package.json
+1
-1
1 addition, 1 deletion
apps/images/package.json
with
26 additions
and
16 deletions
apps/email/package.json
+
1
−
1
View file @
c4f37937
...
...
@@ -46,7 +46,7 @@
"scripts"
:
{
"lint"
:
"pnpm eslint ."
,
"transpile"
:
"tsc --noEmit"
,
"dev"
:
"pnpm build &&
pnpm prod
"
,
"dev"
:
"pnpm build &&
node build/server.js
"
,
"build"
:
"tsup"
,
"prod"
:
"node --experimental-modules --experimental-json-modules bundle/server.js"
,
"coverage"
:
"vitest --coverage"
,
...
...
This diff is collapsed.
Click to expand it.
apps/fullstack/app/api/account/user/route.ts
+
24
−
14
View file @
c4f37937
...
...
@@ -3,6 +3,7 @@ import { RequestProps } from "lib/route_wrapper/wrapperSession";
import
{
NextRequest
,
NextResponse
}
from
"
next/server
"
;
import
z
from
"
zod
"
;
import
{
SnipSessionData
}
from
"
@snip/auth/session
"
;
import
service
from
"
@snip/database
"
;
import
{
NotFoundError
}
from
"
@snip/database/errors
"
;
import
{
...
...
@@ -49,6 +50,7 @@ async function GetUserData(
const
{
config
,
groups
,
last_logins
}
=
res
.
data
;
// Create promises we resolve together at the end
const
userDataP
=
service
.
user
.
getById
(
session
.
user
.
id
);
let
userConfigDataP
:
Promise
<
UserConfigDataRet
>
|
undefined
;
...
...
@@ -104,20 +106,28 @@ async function GetUserData(
}
// Resolve promises
const
[
userData
,
userConfigData
,
groupsData
,
lastLoginsData
]
=
await
Promise
.
all
([
userDataP
,
userConfigDataP
,
groupsDataP
,
lastLoginsDataP
,
]);
const
ret
:
UserRouteResponseReturn
=
{
user
:
userData
,
userConfig
:
userConfigData
,
groups
:
groupsData
,
lastLogins
:
lastLoginsData
,
};
let
ret
:
UserRouteResponseReturn
;
try
{
const
[
userData
,
userConfigData
,
groupsData
,
lastLoginsData
]
=
await
Promise
.
all
([
userDataP
,
userConfigDataP
,
groupsDataP
,
lastLoginsDataP
,
]);
ret
=
{
user
:
userData
,
userConfig
:
userConfigData
,
groups
:
groupsData
,
lastLogins
:
lastLoginsData
,
};
}
catch
(
_e
)
{
await
(
session
as
SnipSessionData
).
destroy
();
return
NextResponse
.
json
(
{
error
:
"
Failed to get user data
"
},
{
status
:
500
},
);
}
return
NextResponse
.
json
<
UserRouteResponseReturn
>
(
ret
,
{
status
:
200
});
}
This diff is collapsed.
Click to expand it.
apps/images/package.json
+
1
−
1
View file @
c4f37937
...
...
@@ -52,7 +52,7 @@
"lint"
:
"pnpm eslint ."
,
"transpile"
:
"tsc --noEmit"
,
"build"
:
"tsup"
,
"dev"
:
"pnpm build &&
pnpm prod
"
,
"dev"
:
"pnpm build &&
node build/cluster.js
"
,
"prod"
:
"node --experimental-modules --experimental-wasm-modules bundle/cluster.js"
,
"test"
:
"vitest"
,
"bundle"
:
"rollup -c"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment