mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Ensured domain is passed when loading detail for a short URL on a specific domain
This commit is contained in:
parent
707c9f4ce6
commit
170e427530
2 changed files with 9 additions and 9 deletions
|
@ -33,8 +33,8 @@ const ShortUrlVisits = (
|
|||
};
|
||||
|
||||
state = { startDate: undefined, endDate: undefined };
|
||||
loadVisits = () => {
|
||||
const { match: { params }, location: { search }, getShortUrlVisits } = this.props;
|
||||
loadVisits = (loadDetail = false) => {
|
||||
const { match: { params }, location: { search }, getShortUrlVisits, getShortUrlDetail } = this.props;
|
||||
const { shortCode } = params;
|
||||
const dates = mapObjIndexed(formatDate(), this.state);
|
||||
const { startDate, endDate } = dates;
|
||||
|
@ -44,15 +44,15 @@ const ShortUrlVisits = (
|
|||
// While the "page" is loaded, use the timestamp + filtering dates as memoization IDs for stats calculations
|
||||
this.memoizationId = `${this.timeWhenMounted}_${shortCode}_${startDate}_${endDate}`;
|
||||
getShortUrlVisits(shortCode, { startDate, endDate, domain });
|
||||
|
||||
if (loadDetail) {
|
||||
getShortUrlDetail(shortCode, domain);
|
||||
}
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
const { match: { params }, getShortUrlDetail } = this.props;
|
||||
const { shortCode } = params;
|
||||
|
||||
this.timeWhenMounted = new Date().getTime();
|
||||
this.loadVisits();
|
||||
getShortUrlDetail(shortCode);
|
||||
this.loadVisits(true);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
|
|
@ -26,13 +26,13 @@ export default handleActions({
|
|||
[GET_SHORT_URL_DETAIL]: (state, { shortUrl }) => ({ shortUrl, loading: false, error: false }),
|
||||
}, initialState);
|
||||
|
||||
export const getShortUrlDetail = (buildShlinkApiClient) => (shortCode) => async (dispatch, getState) => {
|
||||
export const getShortUrlDetail = (buildShlinkApiClient) => (shortCode, domain) => async (dispatch, getState) => {
|
||||
dispatch({ type: GET_SHORT_URL_DETAIL_START });
|
||||
|
||||
const { getShortUrl } = await buildShlinkApiClient(getState);
|
||||
|
||||
try {
|
||||
const shortUrl = await getShortUrl(shortCode);
|
||||
const shortUrl = await getShortUrl(shortCode, domain);
|
||||
|
||||
dispatch({ shortUrl, type: GET_SHORT_URL_DETAIL });
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in a new issue