-
-
Notifications
You must be signed in to change notification settings - Fork 100
Closed
Description
Hello 👋,
I have question about using class based validators.
The use case is about having validator dependent on a service.
import Validator from 'ember-changeset-validations/validator';
import { inject as service } from '@ember/service';
export default class PersonalNoValidator extends Validator {
@service ajax;
async validate(key, newValue, oldValue, changes, content) {
try {
await this.ajax.post('/api/personal-no/validation', { data: newValue });
return true;
} catch (_) {
return 'Personal No is invalid';
}
}
}
Would it make sense to support this, or is there a path to solve this currently?
Thanks
rickieshi, SergeAstapov, majnikov, sandstrom, hussienliban and 3 more