Progress
This commit is contained in:
@@ -100,12 +100,11 @@ function getFromDB(dispatch, getState, index, id) {
|
||||
|
||||
export function fetchAccount(id) {
|
||||
return (dispatch, getState) => {
|
||||
dispatch(fetchRelationships([id]));
|
||||
|
||||
if (id === -1 || getState().getIn(['accounts', id], null) !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch(fetchRelationships([id]));
|
||||
dispatch(fetchAccountRequest(id));
|
||||
|
||||
openDB().then(db => getFromDB(
|
||||
@@ -128,8 +127,13 @@ export function fetchAccount(id) {
|
||||
|
||||
export function fetchAccountByUsername(username) {
|
||||
return (dispatch, getState) => {
|
||||
if (!username) {
|
||||
return;
|
||||
}
|
||||
|
||||
api(getState).get(`/api/v1/account_by_username/${username}`).then(response => {
|
||||
dispatch(importFetchedAccount(response.data));
|
||||
dispatch(importFetchedAccount(response.data))
|
||||
dispatch(fetchRelationships([response.data.id]))
|
||||
}).then(() => {
|
||||
dispatch(fetchAccountSuccess());
|
||||
}).catch(error => {
|
||||
|
||||
@@ -165,14 +165,15 @@ export function expandNotifications({ maxId } = {}, done = noOp) {
|
||||
// filter verified and following here too
|
||||
const params = {
|
||||
max_id: maxId,
|
||||
// only_verified: onlyVerified,
|
||||
// only_following: onlyFollowing,
|
||||
exclude_types: activeFilter === 'all' ? null : excludeTypesFromFilter(activeFilter),
|
||||
// exclude_types: activeFilter === 'all'
|
||||
// ? excludeTypesFromSettings(getState())
|
||||
// : excludeTypesFromFilter(activeFilter),
|
||||
};
|
||||
|
||||
if (!!onlyVerified) params.only_verified = onlyVerified
|
||||
if (!!onlyFollowing) params.only_following = onlyFollowing
|
||||
|
||||
if (!maxId && notifications.get('items').size > 0) {
|
||||
params.since_id = notifications.getIn(['items', 0, 'id']);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ export const fetchGifCategories = () => {
|
||||
|
||||
dispatch(fetchGifCategoriesRequest())
|
||||
|
||||
api(getState).get('/api/v1/gifs').then(response => {
|
||||
api(getState).get('/api/v1/gifs/categories').then(response => {
|
||||
dispatch(fetchGifCategoriesSuccess(response.data.tags))
|
||||
}).catch(function (error) {
|
||||
dispatch(fetchGifCategoriesFail(error))
|
||||
@@ -29,24 +29,25 @@ export const fetchGifCategories = () => {
|
||||
}
|
||||
}
|
||||
|
||||
export const fetchGifResults = (maxId) => {
|
||||
export const fetchGifResults = (expand) => {
|
||||
return function (dispatch, getState) {
|
||||
if (!me) return
|
||||
|
||||
dispatch(fetchGifResultsRequest())
|
||||
|
||||
const searchText = getState().getIn(['tenor', 'searchText'], '');
|
||||
const search = getState().getIn(['tenor', 'searchText'], '');
|
||||
const pos = 0 //expand ? getState().getIn(['tenor', 'results'], []).length
|
||||
|
||||
axios.get(`https://api.tenor.com/v1/search?q=${searchText}&media_filter=minimal&limit=30&key=${tenorkey}`)
|
||||
.then((response) => {
|
||||
console.log('response:', response)
|
||||
dispatch(fetchGifResultsSuccess(response.data.results))
|
||||
}).catch(function (error) {
|
||||
dispatch(fetchGifResultsFail(error))
|
||||
})
|
||||
api(getState).get('/api/v1/gifs/search', { search, pos }).then((response) => {
|
||||
console.log("response.data:", response.data)
|
||||
dispatch(fetchGifResultsSuccess(response.data))
|
||||
}).catch(function (error) {
|
||||
dispatch(fetchGifResultsFail(error))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const clearGifResults = () => ({
|
||||
type: GIFS_CLEAR_RESULTS,
|
||||
})
|
||||
@@ -69,10 +70,10 @@ function fetchGifResultsRequest() {
|
||||
}
|
||||
}
|
||||
|
||||
function fetchGifResultsSuccess(results) {
|
||||
function fetchGifResultsSuccess(data) {
|
||||
return {
|
||||
type: GIF_RESULTS_FETCH_SUCCESS,
|
||||
results,
|
||||
data,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ export function expandTimeline(timelineId, path, params = {}, done = noOp) {
|
||||
|
||||
export const expandHomeTimeline = ({ maxId } = {}, done = noOp) => expandTimeline('home', '/api/v1/timelines/home', { max_id: maxId }, done);
|
||||
export const expandCommunityTimeline = ({ maxId, onlyMedia } = {}, done = noOp) => expandTimeline(`community${onlyMedia ? ':media' : ''}`, '/api/v1/timelines/public', { local: true, max_id: maxId, only_media: !!onlyMedia }, done);
|
||||
export const expandAccountTimeline = (accountId, { maxId, withReplies } = {}) => expandTimeline(`account:${accountId}${withReplies ? ':with_replies' : ''}`, `/api/v1/accounts/${accountId}/statuses`, { exclude_replies: !withReplies, max_id: maxId });
|
||||
export const expandAccountTimeline = (accountId, { maxId, withReplies, commentsOnly } = {}) => expandTimeline(`account:${accountId}${withReplies ? ':with_replies' : ''}${commentsOnly ? ':comments_only' : ''}`, `/api/v1/accounts/${accountId}/statuses`, { only_comments: commentsOnly, exclude_replies: (!withReplies && !commentsOnly), max_id: maxId });
|
||||
export const expandAccountFeaturedTimeline = accountId => expandTimeline(`account:${accountId}:pinned`, `/api/v1/accounts/${accountId}/statuses`, { pinned: true });
|
||||
export const expandAccountMediaTimeline = (accountId, { maxId, limit } = {}) => expandTimeline(`account:${accountId}:media`, `/api/v1/accounts/${accountId}/statuses`, { max_id: maxId, only_media: true, limit: limit || 20 });
|
||||
export const expandListTimeline = (id, { maxId } = {}, done = noOp) => expandTimeline(`list:${id}`, `/api/v1/timelines/list/${id}`, { max_id: maxId }, done);
|
||||
|
||||
Reference in New Issue
Block a user