это мой класс обслуживания
getAllList(): Promise<Array<Sample>> {
return http
.get('localhost:8080')
.then(response => {
console.log("!!!!!!",response.data);
return response.data.map((sam) => new Sample(sam.sam));
})
.catch(error => {
throw error;
});
}
это класс компонентов, откуда я звоню в мой сервис:
componentDidMount() {
this.Service
.getAllList()
.then((sample) => {
this.setState((state) => {
return Object.assign({}, state, { sample: sample.values });
});
})
.catch((err) => {
console.log(err);
});
Класс модели:
export default class Sample {
product1: string;
info: {
product2: string;
product3: string;
product4: string;
};
Что неправильно в этом коде? и кто-нибудь может мне помочь с тем, как распечатать данные, которые я получаю от вызова API в компоненте