Запросы к Api, ошибка в Promise
Делаю запрос к https://www.boredapi.com/documentation#endpoints-participants , но выдает ошибку activityService.js:20 Uncaught (in promise) RangeError: Maximum call stack size exceeded
class ActivityService {
constructor() {
this._apBase = "http://www.boredapi.com/api/activity";
}
async getResource(url) {
const res = await fetch(`${this._apiBase}${url}`);
if (!res.ok) {
throw new Error(`Could not fetch ${url}` + `, received ${res.status}`);
}
return await res.json();
}
async getType() {
const res = await this.getResource(`?type=:type`)
}
}
const activity = new ActivityService;
activity.getType()
.then(res => console.log(res));