fetch.js 246 B

123456789101112
  1. export class fetchObject{
  2. constructor(url, id) {
  3. this.url = url + '/' + id
  4. }
  5. async getCounter() {
  6. const response = await fetch(this.url);
  7. const counter = await response.json();
  8. return counter;
  9. }
  10. }