@xrengine/server-core
Version:
Shared components for XREngine server
18 lines (15 loc) • 608 B
text/typescript
import { HookContext } from '@feathersjs/feathers'
import { UserInterface } from '@xrengine/common/src/interfaces/User'
// TODO: Make one hook by combine this with "set-loggedin-user-in-body"
// This will attach the loggedIn user id in the query property
export default (propertyName: string) => {
return (context: HookContext): HookContext => {
// Getting logged in user and attaching owner of user
const loggedInUser = context.params.user as UserInterface
context.params.query = {
...context.params.query,
[]: loggedInUser?.id || null
}
return context
}
}