Add interface for account docs of NeDB

This commit is contained in:
kPherox 2019-04-27 18:49:31 +09:00
parent f32e28b914
commit ed8514c8c7
No known key found for this signature in database
GPG Key ID: C04751C2BFA2F62D

View File

@ -2,7 +2,16 @@ import { ipcMain, Event, shell, app } from "electron"
import Mastodon, { Response, Account } from "megalodon" import Mastodon, { Response, Account } from "megalodon"
import { join } from "path" import { join } from "path"
import Datastore from "nedb" import Datastore from "nedb"
import Window from "./Window"
interface AccountDoc {
_id?: string
domain: string
acct: string
avatar: string
avatarStatic: string
accessToken: string
color?: string
}
export default class Auth { export default class Auth {
public static ready() { public static ready() {
@ -67,13 +76,12 @@ export default class Auth {
filename: join(app.getPath("userData"), "account.db"), filename: join(app.getPath("userData"), "account.db"),
autoload: true autoload: true
}) })
let docs = { let docs: AccountDoc = {
domain: instance, domain: instance,
acct: you.acct, acct: you.acct,
avatar: you.avatar, avatar: you.avatar,
avatarStatic: you.avatar_static, avatarStatic: you.avatar_static,
accessToken: tokenData.accessToken, accessToken: tokenData.accessToken,
color: undefined
} }
db.insert(docs, function (err, newDocs) { db.insert(docs, function (err, newDocs) {
if (err) { if (err) {