Resolve #3119
This commit is contained in:
		@@ -105,9 +105,9 @@ export default Vue.extend({
 | 
			
		||||
			this.init();
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		init() {
 | 
			
		||||
		async init() {
 | 
			
		||||
			this.fetching = true;
 | 
			
		||||
			this.makePromise().then(x => {
 | 
			
		||||
			await (this.makePromise()).then(x => {
 | 
			
		||||
				if (Array.isArray(x)) {
 | 
			
		||||
					this.notes = x;
 | 
			
		||||
				} else {
 | 
			
		||||
@@ -122,7 +122,7 @@ export default Vue.extend({
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		fetchMore() {
 | 
			
		||||
		async fetchMore() {
 | 
			
		||||
			if (!this.more || this.moreFetching || this.notes.length === 0) return;
 | 
			
		||||
			this.moreFetching = true;
 | 
			
		||||
			this.makePromise(this.notes[this.notes.length - 1].id).then(x => {
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,7 @@
 | 
			
		||||
import Vue from 'vue';
 | 
			
		||||
import i18n from '../../../i18n';
 | 
			
		||||
import Progress from '../../../common/scripts/loading';
 | 
			
		||||
import { genSearchQuery } from '../../../common/scripts/gen-search-query';
 | 
			
		||||
 | 
			
		||||
const limit = 20;
 | 
			
		||||
 | 
			
		||||
@@ -21,10 +22,10 @@ export default Vue.extend({
 | 
			
		||||
	i18n: i18n('desktop/views/pages/search.vue'),
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			makePromise: cursor => this.$root.api('notes/search', {
 | 
			
		||||
			makePromise: async cursor => this.$root.api('notes/search', {
 | 
			
		||||
				limit: limit + 1,
 | 
			
		||||
				offset: cursor ? cursor : undefined,
 | 
			
		||||
				query: this.q
 | 
			
		||||
				...(await genSearchQuery(this, this.q))
 | 
			
		||||
			}).then(notes => {
 | 
			
		||||
				if (notes.length == limit + 1) {
 | 
			
		||||
					notes.pop();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user