Skip to content

Commit

Permalink
fix: check for empty dated value
Browse files Browse the repository at this point in the history
  • Loading branch information
mvayngrib committed Jan 2, 2018
1 parent 6489d45 commit adbf4b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/samplebot/customize.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions src/samplebot/customize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { createConf } from './configure'
import Errors = require('../errors')

const ONFIDO_PLUGIN_PATH = 'products.plugins.onfido'
const emptyStringToUndefined = val => val === "" ? undefined : val

export async function customize (opts) {
let { lambda, bot, delayReady, event } = opts
Expand All @@ -27,12 +26,14 @@ export async function customize (opts) {
Errors.ignore(err, Errors.NotFound)
return undefined
}),
confy.termsAndConditions.getDatedValue().catch(err => {
// TODO: maybe store in local fs instead of in memory
Errors.ignore(err, Errors.NotFound)
return undefined
})
.then(emptyStringToUndefined)
confy.termsAndConditions.getDatedValue()
// ignore empty values
.then(datedValue => datedValue.value && datedValue)
.catch(err => {
// TODO: maybe store in local fs instead of in memory
Errors.ignore(err, Errors.NotFound)
return undefined
})
])

const { domain } = org
Expand Down

0 comments on commit adbf4b7

Please sign in to comment.