day len server theo loi Khoi noi, toi xin tuyen bo mien tru trach nhiem
This commit is contained in:
@@ -262,7 +262,10 @@ export class UserSchema extends PothosSchema {
|
||||
if (ctx.isSubscription) {
|
||||
throw new Error('Not allowed')
|
||||
}
|
||||
const id = ctx.http.me.id
|
||||
const id = ctx.http.me?.id
|
||||
if (!id) {
|
||||
throw new Error('User not found')
|
||||
}
|
||||
if (args.imageBlob) {
|
||||
const { mimetype, createReadStream } = await args.imageBlob
|
||||
if (mimetype && createReadStream) {
|
||||
@@ -333,7 +336,7 @@ export class UserSchema extends PothosSchema {
|
||||
throw new Error('Not allowed')
|
||||
}
|
||||
// check context is admin
|
||||
if (ctx.http.me.role !== 'ADMIN') {
|
||||
if (ctx.http.me?.role !== 'ADMIN') {
|
||||
throw new UnauthorizedException(`Only admin can invite moderator`)
|
||||
}
|
||||
let user
|
||||
|
||||
Reference in New Issue
Block a user