mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-28 07:43:42 +01:00
9bd23dc4e5
* Track trending tags - Half-life of 1 day - Historical usage in daily buckets (last 7 days stored) - GET /api/v1/trends Fix #271 * Add trends to web UI * Don't render compose form on search route, adjust search results header * Disqualify tag from trends if it's in disallowed hashtags setting * Count distinct accounts using tag, ignore silenced accounts
32 lines
792 B
JavaScript
32 lines
792 B
JavaScript
import api from '../api';
|
|
|
|
export const TRENDS_FETCH_REQUEST = 'TRENDS_FETCH_REQUEST';
|
|
export const TRENDS_FETCH_SUCCESS = 'TRENDS_FETCH_SUCCESS';
|
|
export const TRENDS_FETCH_FAIL = 'TRENDS_FETCH_FAIL';
|
|
|
|
export const fetchTrends = () => (dispatch, getState) => {
|
|
dispatch(fetchTrendsRequest());
|
|
|
|
api(getState)
|
|
.get('/api/v1/trends')
|
|
.then(({ data }) => dispatch(fetchTrendsSuccess(data)))
|
|
.catch(err => dispatch(fetchTrendsFail(err)));
|
|
};
|
|
|
|
export const fetchTrendsRequest = () => ({
|
|
type: TRENDS_FETCH_REQUEST,
|
|
skipLoading: true,
|
|
});
|
|
|
|
export const fetchTrendsSuccess = trends => ({
|
|
type: TRENDS_FETCH_SUCCESS,
|
|
trends,
|
|
skipLoading: true,
|
|
});
|
|
|
|
export const fetchTrendsFail = error => ({
|
|
type: TRENDS_FETCH_FAIL,
|
|
error,
|
|
skipLoading: true,
|
|
skipAlert: true,
|
|
});
|