randydev commited on
Commit
1807c59
·
verified ·
1 Parent(s): 337ec73

Update plugins/federations.js

Browse files
Files changed (1) hide show
  1. 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(400).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
  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
  });