| @@ -33,12 +33,13 @@ userProfileRoutes.get('/deep-copy/', jwtAuthentication, async (request, response | |||||
| const wordCollection = getDatabaseClient().db(DB_NAME).collection<Word>('words'); | const wordCollection = getDatabaseClient().db(DB_NAME).collection<Word>('words'); | ||||
| const allDeepCategories: any = []; | const allDeepCategories: any = []; | ||||
| let allCategories; | |||||
| const allCategories = await categoryCollection.find({ | |||||
| _id: { $in: user.categories.map(id => new ObjectId(id)) } | |||||
| }).toArray(); | |||||
| if (allCategories === undefined) { | |||||
| try { | |||||
| allCategories = await categoryCollection.find({ | |||||
| _id: { $in: user.categories.map(id => new ObjectId(id)) } | |||||
| }).toArray(); | |||||
| } catch { | |||||
| response.status(200); | response.status(200); | ||||
| response.json({ | response.json({ | ||||
| _id: user._id, | _id: user._id, | ||||