Skip to content
This repository has been archived by the owner on Nov 15, 2017. It is now read-only.

Commit

Permalink
Add context to validation aggregator
Browse files Browse the repository at this point in the history
  • Loading branch information
fastner committed May 12, 2016
1 parent 2e45094 commit dcdb1de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/VuexValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class GlobalValidator {

const validator = new GlobalValidator()

function computedValidation(id, rulesLength)
function computedValidation(context, id, rulesLength)
{
return function()
{
let allResults = true
for (let index = 0; index < rulesLength; index++)
{
const curResult = this[`${id}${index}`]
const curResult = context[`${id}${index}`]

if (curResult !== true)
if (allResults === true)
Expand Down Expand Up @@ -101,7 +101,7 @@ function install(Vue, { validators: _validators } = { validators: [] })
{
getters[`${id}${index}`] = callValidatorFunction(ruleContext, rule.validatorFunction, state)
})
getters[id] = computedValidation(id, rulesLength)
getters[id] = computedValidation(ruleContext, id, rulesLength)
}
})
})
Expand Down

0 comments on commit dcdb1de

Please sign in to comment.