Add config page

This commit is contained in:
Shweelan Samson authored and Zaid Abdulla committed 2019-02-04 23:47:54 -08:00
1 parent 1e41c72d60
commit 498947bc4a
11 files changed
+372 -7

No files matched your search

+32
View File
@@ -187,6 +187,38 @@ export function count(resource, filter) {
});
}
export function deleteConfig(id) {
return new Promise((resolve, reject) => {
getClient()
.then(client => {
const collection = client
.db()
.collection(RESOURCE_COLLECTION["config"] || "config");
collection.deleteOne({ _id: id }, err => {
if (err) return void reject(err);
resolve();
});
})
.catch(reject);
});
}
export function putConfig(id, object) {
return new Promise((resolve, reject) => {
getClient()
.then(client => {
const collection = client
.db()
.collection(RESOURCE_COLLECTION["config"] || "config");
collection.replaceOne({ _id: id }, object, { upsert: true }, err => {
if (err) return void reject(err);
resolve();
});
})
.catch(reject);
});
}
export function disconnect() {
if (_clientPromise) {
_clientPromise.then(client => {