Add validation to challenge completion
Change ajax requests to send and accept JSON to preserve data types. Fix typos
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
import validator from 'express-validator';
|
||||
|
||||
export default validator.bind(validator, {
|
||||
customValidators: {
|
||||
matchRegex: function matchRegex(param, regex) {
|
||||
return regex.test(param);
|
||||
export default function() {
|
||||
return validator({
|
||||
customValidators: {
|
||||
matchRegex(param, regex) {
|
||||
return regex.test(param);
|
||||
},
|
||||
isString(value) {
|
||||
return typeof value === 'string';
|
||||
},
|
||||
isNumber(value) {
|
||||
return typeof value === 'number';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user