mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-05-31 17:46:17 +00:00
Defined visit stats page
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import axios from 'axios';
|
||||
import qs from 'qs';
|
||||
import { isEmpty, isNil, pipe, reject } from 'ramda';
|
||||
import { isEmpty, isNil, reject } from 'ramda';
|
||||
|
||||
const API_VERSION = '1';
|
||||
|
||||
@@ -22,11 +22,6 @@ export class ShlinkApiClient {
|
||||
this._apiKey = apiKey;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the list of short URLs
|
||||
* @param options
|
||||
* @returns {Promise<Array>}
|
||||
*/
|
||||
listShortUrls = (options = {}) =>
|
||||
this._performRequest('/short-codes', 'GET', options)
|
||||
.then(resp => resp.data.shortUrls)
|
||||
@@ -39,6 +34,11 @@ export class ShlinkApiClient {
|
||||
.catch(e => this._handleAuthError(e, this.listShortUrls, [filteredOptions]));
|
||||
};
|
||||
|
||||
getShortUrlVisits = shortCode =>
|
||||
this._performRequest(`/short-codes/${shortCode}/visits`, 'GET')
|
||||
.then(resp => resp.data.visits.data)
|
||||
.catch(e => this._handleAuthError(e, this.listShortUrls, [shortCode]));
|
||||
|
||||
_performRequest = async (url, method = 'GET', params = {}, data = {}) => {
|
||||
if (isEmpty(this._token)) {
|
||||
this._token = await this._authenticate();
|
||||
|
||||
Reference in New Issue
Block a user