api/APIwrapper.js
// a method to refresh the token within the 24hrs span sending the old one
a method to refresh the token within the 24hrs span sending the old one
a method to refresh the token within the 24hrs span sending the old one
async refreshToken() {
    const refreshTokenURL = 'https://api.thetvdb.com/refresh_token';
    let res = await fetch(refreshTokenURL, {
      headers: {
        'Authorization': `Bearer ${this.token}`
      }
    });
    let data = await res.json();
    if (data['token']) {
      let refreshToken = data['token'];
      return refreshToken;
    }
    return data;
  }
async refreshToken ( ) { const refreshTokenURL = 'https://api.thetvdb.com/refresh_token' ; let res = await fetch ( refreshTokenURL , { headers : { 'Authorization' : ` ${ this . token } ` } } ) ; let data = await res . json ( ) ; if ( data [ 'token' ] ) { let refreshToken = data [ 'token' ] ; return refreshToken ; } return data ; }
a method to refresh the token within the 24hrs span sending the old one
a method to refresh the token within the 24hrs span sending the old one