Update index.js
Browse files
index.js
CHANGED
@@ -159,7 +159,7 @@ app.post('/v1/generate-key', async (req, res) => {
|
|
159 |
const existingUser = await collection.findOne({ owner: userIdNumber });
|
160 |
|
161 |
if (existingUser) {
|
162 |
-
return res.status(200).json({ apiKey: existingUser.key });
|
163 |
}
|
164 |
const userDocument = {
|
165 |
key: newKey,
|
|
|
159 |
const existingUser = await collection.findOne({ owner: userIdNumber });
|
160 |
|
161 |
if (existingUser) {
|
162 |
+
return res.status(200).json({ apiKey: existingUser.key, createdAt: existingUser.createdAt });
|
163 |
}
|
164 |
const userDocument = {
|
165 |
key: newKey,
|