diff --git a/backend/index.js b/backend/index.js
index f9c6219..dfb7c94 100644
--- a/backend/index.js
+++ b/backend/index.js
@@ -2,6 +2,7 @@ const express = require('express');
const cors = require('cors');
const { initializeApp, applicationDefault, cert } = require('firebase-admin/app');
const { getFirestore, Timestamp, FieldValue } = require('firebase-admin/firestore');
+const { verifyIdToken } = require('firebase-admin/auth')
const serviceAccount = require('./firebase.json');
@@ -48,6 +49,35 @@ app.post('/checkrelatiecode', async (req, res) => {
} catch (e) {
- return res.status(500).send({ error: e })
+ return res.status(500).send({ code: 'error', error: e })
+ }
+})
+
+app.post('/getrelatiecodes', async (req, res) => {
+ const { email } = req.body;
+
+ if (!email) return res.status(400).send({ code: 'no-email'})
+
+ try {
+ const ledenlijstRef = db.collection('ledenlijst')
+
+ const snapshot = await ledenlijstRef.where("email", "array-contains", email).get()
+
+ if (snapshot.empty) {
+ res.status(400).send({ code: 'no-relatiecodes'})
+ return;
+ }
+
+ let relatiecodes = [];
+
+ snapshot.forEach(doc => {
+ relatiecodes.push(doc.id)
+ });
+
+ res.status(200).send({ code: 'success', relatiecodes: relatiecodes })
+
+
+ } catch (e) {
+ return res.status(500).send({ code: 'error', error: e })
}
})
\ No newline at end of file
diff --git a/frontend/app.vue b/frontend/app.vue
index 0841c99..39a64d2 100644
--- a/frontend/app.vue
+++ b/frontend/app.vue
@@ -17,7 +17,7 @@
\ No newline at end of file
diff --git a/frontend/components/Login.vue b/frontend/components/Login.vue
index 28769d5..6ae9818 100644
--- a/frontend/components/Login.vue
+++ b/frontend/components/Login.vue
@@ -43,8 +43,10 @@
\ No newline at end of file