Refactor & Clean up
This commit is contained in:
@ -66,32 +66,32 @@ export default Vue.extend({
|
||||
this.query = {
|
||||
query: this.tagTl.query
|
||||
};
|
||||
this.connection = (this as any).os.stream.connectToChannel('hashtag', { q: this.tagTl.query });
|
||||
this.connection = this.$root.stream.connectToChannel('hashtag', { q: this.tagTl.query });
|
||||
this.connection.on('note', prepend);
|
||||
} else if (this.src == 'home') {
|
||||
this.endpoint = 'notes/timeline';
|
||||
const onChangeFollowing = () => {
|
||||
this.fetch();
|
||||
};
|
||||
this.connection = (this as any).os.stream.useSharedConnection('homeTimeline');
|
||||
this.connection = this.$root.stream.useSharedConnection('homeTimeline');
|
||||
this.connection.on('note', prepend);
|
||||
this.connection.on('follow', onChangeFollowing);
|
||||
this.connection.on('unfollow', onChangeFollowing);
|
||||
} else if (this.src == 'local') {
|
||||
this.endpoint = 'notes/local-timeline';
|
||||
this.connection = (this as any).os.stream.useSharedConnection('localTimeline');
|
||||
this.connection = this.$root.stream.useSharedConnection('localTimeline');
|
||||
this.connection.on('note', prepend);
|
||||
} else if (this.src == 'hybrid') {
|
||||
this.endpoint = 'notes/hybrid-timeline';
|
||||
this.connection = (this as any).os.stream.useSharedConnection('hybridTimeline');
|
||||
this.connection = this.$root.stream.useSharedConnection('hybridTimeline');
|
||||
this.connection.on('note', prepend);
|
||||
} else if (this.src == 'global') {
|
||||
this.endpoint = 'notes/global-timeline';
|
||||
this.connection = (this as any).os.stream.useSharedConnection('globalTimeline');
|
||||
this.connection = this.$root.stream.useSharedConnection('globalTimeline');
|
||||
this.connection.on('note', prepend);
|
||||
} else if (this.src == 'mentions') {
|
||||
this.endpoint = 'notes/mentions';
|
||||
this.connection = (this as any).os.stream.useSharedConnection('main');
|
||||
this.connection = this.$root.stream.useSharedConnection('main');
|
||||
this.connection.on('mention', prepend);
|
||||
} else if (this.src == 'messages') {
|
||||
this.endpoint = 'notes/mentions';
|
||||
@ -103,7 +103,7 @@ export default Vue.extend({
|
||||
prepend(note);
|
||||
}
|
||||
};
|
||||
this.connection = (this as any).os.stream.useSharedConnection('main');
|
||||
this.connection = this.$root.stream.useSharedConnection('main');
|
||||
this.connection.on('mention', onNote);
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ export default Vue.extend({
|
||||
this.fetching = true;
|
||||
|
||||
(this.$refs.timeline as any).init(() => new Promise((res, rej) => {
|
||||
(this as any).api(this.endpoint, Object.assign({
|
||||
this.$root.api(this.endpoint, Object.assign({
|
||||
limit: fetchLimit + 1,
|
||||
untilDate: this.date ? this.date.getTime() : undefined
|
||||
}, this.baseQuery, this.query)).then(notes => {
|
||||
@ -139,7 +139,7 @@ export default Vue.extend({
|
||||
|
||||
this.moreFetching = true;
|
||||
|
||||
const promise = (this as any).api(this.endpoint, Object.assign({
|
||||
const promise = this.$root.api(this.endpoint, Object.assign({
|
||||
limit: fetchLimit + 1,
|
||||
untilId: (this.$refs.timeline as any).tail().id
|
||||
}, this.baseQuery, this.query));
|
||||
|
Reference in New Issue
Block a user