mirror of https://github.com/Budibase/budibase.git
11 changed files with 91 additions and 75 deletions
@ -1,31 +1,31 @@ |
|||
import { isString } from "lodash/fp" |
|||
// import { isString } from "lodash/fp"
|
|||
|
|||
import { |
|||
BB_STATE_BINDINGPATH, |
|||
BB_STATE_FALLBACK, |
|||
BB_STATE_BINDINGSOURCE, |
|||
isBound, |
|||
parseBinding, |
|||
} from "@budibase/client/src/state/parseBinding" |
|||
// import {
|
|||
// BB_STATE_BINDINGPATH,
|
|||
// BB_STATE_FALLBACK,
|
|||
// BB_STATE_BINDINGSOURCE,
|
|||
// isBound,
|
|||
// parseBinding,
|
|||
// } from "@budibase/client/src/state/parseBinding"
|
|||
|
|||
export const isBinding = isBound |
|||
// export const isBinding = isBound
|
|||
|
|||
export const setBinding = ({ path, fallback, source }, binding = {}) => { |
|||
if (isNonEmptyString(path)) binding[BB_STATE_BINDINGPATH] = path |
|||
if (isNonEmptyString(fallback)) binding[BB_STATE_FALLBACK] = fallback |
|||
binding[BB_STATE_BINDINGSOURCE] = source || "store" |
|||
return binding |
|||
} |
|||
// export const setBinding = ({ path, fallback, source }, binding = {}) => {
|
|||
// if (isNonEmptyString(path)) binding[BB_STATE_BINDINGPATH] = path
|
|||
// if (isNonEmptyString(fallback)) binding[BB_STATE_FALLBACK] = fallback
|
|||
// binding[BB_STATE_BINDINGSOURCE] = source || "store"
|
|||
// return binding
|
|||
// }
|
|||
|
|||
export const getBinding = val => { |
|||
const binding = parseBinding(val) |
|||
return binding |
|||
? binding |
|||
: { |
|||
path: "", |
|||
source: "store", |
|||
fallback: "", |
|||
} |
|||
} |
|||
// export const getBinding = val => {
|
|||
// const binding = parseBinding(val)
|
|||
// return binding
|
|||
// ? binding
|
|||
// : {
|
|||
// path: "",
|
|||
// source: "store",
|
|||
// fallback: "",
|
|||
// }
|
|||
// }
|
|||
|
|||
const isNonEmptyString = s => isString(s) && s.length > 0 |
|||
// const isNonEmptyString = s => isString(s) && s.length > 0
|
|||
|
|||
@ -0,0 +1,26 @@ |
|||
const userController = require("../../user") |
|||
|
|||
module.exports = async function createUser(user) { |
|||
console.log("SAVING this user", user) |
|||
|
|||
const ctx = { |
|||
params: { |
|||
instanceId: "inst_60dd510_700f7dc06735403e81d5af91072d7241", |
|||
}, |
|||
request: { |
|||
body: user |
|||
}, |
|||
} |
|||
|
|||
try { |
|||
const response = await userController.create(ctx) |
|||
return { |
|||
user: response |
|||
} |
|||
} catch (err) { |
|||
console.error(err); |
|||
return { |
|||
user: null |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue