Continued updating the e-mail verification and I think I managed to get it working
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import {PERMISSIONS} from "@/constants/userPermissions";
|
||||
import {app} from "@/firebase";
|
||||
import {app, adminApp} from "@/firebase";
|
||||
import {User} from "@/interfaces/user";
|
||||
import {sessionOptions} from "@/lib/session";
|
||||
import {getAuth} from "firebase/auth";
|
||||
import {deleteDoc, doc, getDoc, getFirestore} from "firebase/firestore";
|
||||
import {getAuth} from "firebase-admin/auth";
|
||||
import {withIronSessionApiRoute} from "iron-session/next";
|
||||
import {NextApiRequest, NextApiResponse} from "next";
|
||||
|
||||
const auth = getAuth(app);
|
||||
const db = getFirestore(app);
|
||||
const auth = getAuth(adminApp);
|
||||
|
||||
export default withIronSessionApiRoute(user, sessionOptions);
|
||||
|
||||
@@ -49,9 +49,10 @@ async function del(req: NextApiRequest, res: NextApiResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
await auth.deleteUser(id);
|
||||
await deleteDoc(doc(db, "users", id));
|
||||
|
||||
res.json({...user, id: req.session.user.id});
|
||||
res.json({ok: true});
|
||||
}
|
||||
|
||||
async function get(req: NextApiRequest, res: NextApiResponse) {
|
||||
|
||||
Reference in New Issue
Block a user