1
0
mirror of https://github.com/nolanlawson/pinafore synced 2024-12-12 18:28:03 +01:00
Pinafore-Web-Client-Frontend/routes/_database/accountsAndRelationships.js
2018-02-13 19:34:37 -08:00

20 lines
892 B
JavaScript

import { ACCOUNTS_STORE, RELATIONSHIPS_STORE } from './constants'
import { accountsCache, relationshipsCache } from './cache'
import { cloneForStorage, getGenericEntityWithId, setGenericEntityWithId } from './helpers'
export async function getAccount (instanceName, accountId) {
return getGenericEntityWithId(ACCOUNTS_STORE, accountsCache, instanceName, accountId)
}
export async function setAccount (instanceName, account) {
return setGenericEntityWithId(ACCOUNTS_STORE, accountsCache, instanceName, cloneForStorage(account))
}
export async function getRelationship (instanceName, accountId) {
return getGenericEntityWithId(RELATIONSHIPS_STORE, relationshipsCache, instanceName, accountId)
}
export async function setRelationship (instanceName, relationship) {
return setGenericEntityWithId(RELATIONSHIPS_STORE, relationshipsCache, instanceName, cloneForStorage(relationship))
}