* Front: Model: Write Validators * Front: Plage response validator * Front: API: Typing 'fetch' return * Front: Basic Models: Response Handlers * Front: API: Validate authentication response * Front: Validate Search History * Front: Validate Responses of User updates * Front: On Validation Error, more verbose console error
21 lines
432 B
TypeScript
21 lines
432 B
TypeScript
import Model, { ModelValidator } from './Model';
|
|
import * as yup from 'yup';
|
|
import ResponseHandler from './ResponseHandler';
|
|
|
|
export const ArtistValidator = yup
|
|
.object({
|
|
name: yup.string().required(),
|
|
})
|
|
.concat(ModelValidator);
|
|
|
|
export const ArtistHandler: ResponseHandler<Artist> = {
|
|
validator: ArtistValidator,
|
|
transformer: (value) => value,
|
|
};
|
|
|
|
interface Artist extends Model {
|
|
name: string;
|
|
}
|
|
|
|
export default Artist;
|