Update plugins/federations.js
Browse files- plugins/federations.js +2 -1
plugins/federations.js
CHANGED
@@ -69,13 +69,14 @@ FedsRoutes.post("/api/v2/federation/newfed", authenticateApiKey, apiLimiter, asy
|
|
69 |
const { name, owner } = req.body;
|
70 |
|
71 |
const existing = await Federation.findOne({ name });
|
72 |
-
if (existing) return res.status(
|
73 |
|
74 |
const federation = new Federation({ name, owner, banned_users: [], sub_federations: [] });
|
75 |
await federation.save();
|
76 |
|
77 |
res.json({ message: "Federation created successfully", federation });
|
78 |
} catch (err) {
|
|
|
79 |
res.status(500).json({ error: err.message });
|
80 |
}
|
81 |
});
|
|
|
69 |
const { name, owner } = req.body;
|
70 |
|
71 |
const existing = await Federation.findOne({ name });
|
72 |
+
if (existing) return res.status(200).json({ error: "Federation already exists" });
|
73 |
|
74 |
const federation = new Federation({ name, owner, banned_users: [], sub_federations: [] });
|
75 |
await federation.save();
|
76 |
|
77 |
res.json({ message: "Federation created successfully", federation });
|
78 |
} catch (err) {
|
79 |
+
console.log(err.message);
|
80 |
res.status(500).json({ error: err.message });
|
81 |
}
|
82 |
});
|