link imap sync to server and show email on front
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import API from './API'
|
||||
|
||||
export default {
|
||||
registerMailbox(data) {
|
||||
return API().post('/mail/mailbox', data);
|
||||
registerAccount(data) {
|
||||
return API().post('/mail/account', data);
|
||||
},
|
||||
getMailboxes() {
|
||||
return API().get('/mail/mailboxes');
|
||||
getAccounts() {
|
||||
return API().get('/mail/accounts');
|
||||
},
|
||||
getRooms(mailboxId) {
|
||||
return API().get(`/mail/${mailboxId}/rooms`);
|
||||
|
||||
@@ -25,6 +25,7 @@ const store = createStore({
|
||||
const mailbox = state.mailboxes.find((mailbox) => mailbox.id == payload);
|
||||
// todo fetched mailbox all
|
||||
if (mailbox?.fetched == false) {
|
||||
console.log(payload)
|
||||
API.getRooms(payload)
|
||||
.then((res) => {
|
||||
// todo add if not exist
|
||||
@@ -91,7 +92,7 @@ const store = createStore({
|
||||
},
|
||||
actions: {
|
||||
fetchMailboxes: async (context) => {
|
||||
API.getMailboxes()
|
||||
API.getAccounts()
|
||||
.then((res) => {
|
||||
context.commit("addMailboxes", res.data);
|
||||
})
|
||||
|
||||
@@ -77,7 +77,7 @@ function addMailboxRequest() {
|
||||
tls: true
|
||||
};
|
||||
|
||||
API.registerMailbox(data).then((res) => {
|
||||
API.registerAccount(data).then((res) => {
|
||||
console.log(res.status);
|
||||
}).catch((err) => {
|
||||
console.log(err.request.status)
|
||||
|
||||
Reference in New Issue
Block a user