Add the ability to select a mailbox.

Just log the mailbox ID for now.
This commit is contained in:
Eli Ribble 2024-08-27 23:22:11 -07:00
parent bab5d421d4
commit 656495904b
6 changed files with 104 additions and 9 deletions

View file

@ -6,7 +6,7 @@ import * as base64 from "base-64";
import * as jmapclient from "jmap-client-ts";
import { FetchTransport } from "jmap-client-ts/lib/utils/fetch-transport";
import { IAccount, ISession } from "./types";
import { IAccount, IMailbox, ISession } from "./types";
type Callback = () => void;
@ -65,6 +65,8 @@ export default class Client {
return;
}
emailList(accountId: string, mailboxId: string, ids: Array<string>) {}
mailboxList(accountId: string, ids: Array<string>) {
if (this.jclient == null) return;
this.jclient
@ -75,7 +77,14 @@ export default class Client {
.then((response) => {
if (this.state.session == null) return;
const account = this.state.session.accounts[response.accountId];
account.mailboxes = response.list;
const mailboxes: Array<IMailbox> = [];
response.list.forEach((m) => {
mailboxes.push({
...m,
emails: [],
});
});
account.mailboxes = mailboxes;
this._triggerChange();
});
}