mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-09 23:48:36 +01:00
refactoring
This commit is contained in:
@@ -9,12 +9,16 @@ export default defineEventHandler(async event => {
|
||||
const data = await getRequestData(event, [], ['OWNER']);
|
||||
if (!data) return;
|
||||
|
||||
const { project_id, project } = data;
|
||||
const { project_id, project, user } = data;
|
||||
|
||||
const { email } = await readBody(event);
|
||||
|
||||
const targetUser = await UserModel.findOne({ email });
|
||||
|
||||
if (targetUser && targetUser._id.toString() === project.owner.toString()) {
|
||||
return setResponseStatus(event, 400, 'You cannot invite yourself');
|
||||
}
|
||||
|
||||
|
||||
const link = `http://127.0.0.1:3000/accept_invite?project_id=${project_id.toString()}`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user