Front: Api models validation (#245)

* 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
This commit is contained in:
Arthur Jamet
2023-07-05 09:22:55 +01:00
committed by GitHub
parent 350a4870cd
commit 10d1342294
20 changed files with 575 additions and 287 deletions
+14 -2
View File
@@ -1,8 +1,20 @@
import Model from './Model';
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;
picture?: string;
}
export default Artist;