1
0
Fork 0

Update Timeline component, change api endpoint

This commit is contained in:
Daniel Supernault 2021-12-14 22:24:15 -07:00
parent 0cc1365f98
commit b78a51890d
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 6 additions and 47 deletions

View File

@ -450,7 +450,7 @@
replyStatus: {}, replyStatus: {},
replyText: '', replyText: '',
replyNsfw: false, replyNsfw: false,
emoji: window.App.util.emoji, emoji: [],
showHashtagPosts: false, showHashtagPosts: false,
hashtagPosts: [], hashtagPosts: [],
hashtagPostsName: '', hashtagPostsName: '',
@ -514,21 +514,6 @@
}, },
beforeMount() { beforeMount() {
// let avop = window.localStorage.getItem('pf.feed:avop') === 'always';
// let u = new URLSearchParams(window.location.search);
// if(u.has('a')) {
// switch(u.get('a')) {
// case 'recent_feed':
// if(this.scope === 'home') {
// this.recentFeed = true;
// }
// break;
// case 'vop':
// this.recentFeed = false;
// break;
// }
// }
// this.recentFeed = avop ? false : this.recentFeed;
this.fetchProfile(); this.fetchProfile();
}, },
@ -589,17 +574,13 @@
methods: { methods: {
fetchProfile() { fetchProfile() {
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => { axios.get('/api/v1/accounts/verify_credentials').then(res => {
this.profile = res.data; this.profile = res.data;
if(this.profile.is_admin == true) { if(this.profile.is_admin == true) {
this.modes.mod = true; this.modes.mod = true;
} }
window._sharedData.curUser = res.data; window._sharedData.curUser = res.data;
window.App.util.navatar(); window.App.util.navatar();
// this.$nextTick(() => {
// this.hasStory();
// });
// this.expRec();
}).catch(err => { }).catch(err => {
swal( swal(
'Oops, something went wrong', 'Oops, something went wrong',
@ -633,7 +614,7 @@
}).then(res => { }).then(res => {
let data = res.data; let data = res.data;
if(!data.length) { if(!data || !data.length) {
this.loading = false; this.loading = false;
this.emptyFeed = true; this.emptyFeed = true;
return; return;
@ -651,32 +632,15 @@
this.min_id = Math.max(...ids).toString(); this.min_id = Math.max(...ids).toString();
this.max_id = Math.min(...ids).toString(); this.max_id = Math.min(...ids).toString();
this.loading = false; this.loading = false;
// $('.timeline .pagination').removeClass('d-none');
// if(this.hashtagPosts.length == 0) {
// this.fetchHashtagPosts();
// }
this.$nextTick(() => { this.$nextTick(() => {
this.hasStory(); this.hasStory();
}); });
// this.fetchStories();
// this.rtw();
setTimeout(function() { setTimeout(function() {
document.querySelectorAll('.timeline .card-body .comments .comment-body a').forEach(function(i, e) { document.querySelectorAll('.timeline .card-body .comments .comment-body a').forEach(function(i, e) {
i.href = App.util.format.rewriteLinks(i); i.href = App.util.format.rewriteLinks(i);
}); });
}, 500); }, 500);
// axios.get('/api/pixelfed/v2/discover/posts/trending', {
// params: {
// range: 'daily'
// }
// }).then(res => {
// let data = res.data.filter(post => this.ids.indexOf(post.id) === -1);
// this.discover_feed = data;
// });
}).catch(err => { }).catch(err => {
swal( swal(
'Oops, something went wrong', 'Oops, something went wrong',
@ -733,8 +697,8 @@
self.feed.push(d); self.feed.push(d);
self.ids.push(d.id); self.ids.push(d.id);
// vids.push({ // vids.push({
// sid: d.id, // sid: d.id,
// pid: d.account.id // pid: d.account.id
// }); // });
} }
}); });
@ -744,7 +708,7 @@
$state.loaded(); $state.loaded();
this.loading = false; this.loading = false;
// axios.post('/api/status/view', { // axios.post('/api/status/view', {
// '_v': vids, // '_v': vids,
// }); // });
} else { } else {
$state.complete(); $state.complete();
@ -915,11 +879,6 @@
} }
$('.postCommentsLoader').addClass('d-none'); $('.postCommentsLoader').addClass('d-none');
$('.postCommentsContainer').removeClass('d-none'); $('.postCommentsContainer').removeClass('d-none');
// setTimeout(function() {
// document.querySelectorAll('.status-comment .postCommentsContainer .comment-body a').forEach(function(i, e) {
// i.href = App.util.format.rewriteLinks(i);
// });
// }, 500);
}).catch(error => { }).catch(error => {
if(!error.response) { if(!error.response) {
$('.postCommentsLoader .lds-ring') $('.postCommentsLoader .lds-ring')