link imap sync to server and show email on front
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
const statusCode = require("../utils/statusCodes").statusCodes;
|
||||
const { registerMailbox } = require("../db/api");
|
||||
const { registerAccount } = require("../db/api");
|
||||
const { getAddresseId } = require("../db/mail");
|
||||
|
||||
async function addMailbox(body, res) {
|
||||
async function addAccount(body, res) {
|
||||
const { email, pwd, xoauth, xoauth2, host, port, tls } = body;
|
||||
getAddresseId(email).then((addressId) => {
|
||||
registerMailbox(addressId, pwd, xoauth, xoauth2, host, port, tls)
|
||||
registerAccount(addressId, pwd, xoauth, xoauth2, host, port, tls)
|
||||
.then((mailboxId) => {
|
||||
res.status(statusCode.OK).json({ id: mailboxId });
|
||||
})
|
||||
@@ -16,5 +16,7 @@ async function addMailbox(body, res) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
addMailbox,
|
||||
addAccount,
|
||||
};
|
||||
|
||||
// todo change mailbox to account
|
||||
Reference in New Issue
Block a user