Ensured regular data for a short URL is loaded if defined

This commit is contained in:
Alejandro Celaya
2018-07-30 21:34:06 +02:00
parent 13004f6d57
commit 0f34d473b9
3 changed files with 59 additions and 16 deletions

View File

@@ -39,6 +39,11 @@ export class ShlinkApiClient {
.then(resp => resp.data.visits.data)
.catch(e => this._handleAuthError(e, this.getShortUrlVisits, [shortCode, dates]));
getShortUrl = shortCode =>
this._performRequest(`/short-codes/${shortCode}`, 'GET')
.then(resp => resp.data)
.catch(e => this._handleAuthError(e, this.getShortUrl, [shortCode]));
_performRequest = async (url, method = 'GET', params = {}, data = {}) => {
if (isEmpty(this._token)) {
this._token = await this._authenticate();