From 3bb7b2c1ca05597e0e36bf4f49106490c227fa47 Mon Sep 17 00:00:00 2001 From: Max Wofford Date: Wed, 18 Sep 2019 10:22:07 -0400 Subject: [PATCH] Add airCreate --- src/utils.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/utils.js b/src/utils.js index 41542e20..a197ccac 100644 --- a/src/utils.js +++ b/src/utils.js @@ -23,6 +23,17 @@ export const airPatch = (baseName, recordID, values) => }) }) +export const airCreate = (baseName, fields) => + new Promis((resolve, reject) => { + base(baseName).create([{ fields }], (err, records) => { + if (err) { + console.error(err) + reject(err) + } + resolve(records[0]) + }) + }) + export const airFind = (baseName, fieldName, value) => new Promise((resolve, reject) => { // see airGet() for usage