wip
This commit is contained in:
		
							parent
							
								
									7994aa96e2
								
							
						
					
					
						commit
						c1b77365a0
					
				
					 2 changed files with 16 additions and 14 deletions
				
			
		| 
						 | 
					@ -19,7 +19,6 @@
 | 
				
			||||||
<script lang="ts">
 | 
					<script lang="ts">
 | 
				
			||||||
import Vue from 'vue';
 | 
					import Vue from 'vue';
 | 
				
			||||||
import Progress from '../../../common/scripts/loading';
 | 
					import Progress from '../../../common/scripts/loading';
 | 
				
			||||||
import parse from '../../../common/scripts/parse-search-query';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const limit = 20;
 | 
					const limit = 20;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,10 +65,11 @@ export default Vue.extend({
 | 
				
			||||||
			this.fetching = true;
 | 
								this.fetching = true;
 | 
				
			||||||
			Progress.start();
 | 
								Progress.start();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			(this as any).api('notes/search', Object.assign({
 | 
								(this as any).api('notes/search', {
 | 
				
			||||||
				limit: limit + 1,
 | 
									limit: limit + 1,
 | 
				
			||||||
				offset: this.offset
 | 
									offset: this.offset,
 | 
				
			||||||
			}, parse(this.q))).then(notes => {
 | 
									query: this.q
 | 
				
			||||||
 | 
								}).then(notes => {
 | 
				
			||||||
				if (notes.length == limit + 1) {
 | 
									if (notes.length == limit + 1) {
 | 
				
			||||||
					notes.pop();
 | 
										notes.pop();
 | 
				
			||||||
					this.existMore = true;
 | 
										this.existMore = true;
 | 
				
			||||||
| 
						 | 
					@ -83,10 +83,11 @@ export default Vue.extend({
 | 
				
			||||||
			if (this.moreFetching || this.fetching || this.notes.length == 0 || !this.existMore) return;
 | 
								if (this.moreFetching || this.fetching || this.notes.length == 0 || !this.existMore) return;
 | 
				
			||||||
			this.offset += limit;
 | 
								this.offset += limit;
 | 
				
			||||||
			this.moreFetching = true;
 | 
								this.moreFetching = true;
 | 
				
			||||||
			return (this as any).api('notes/search', Object.assign({
 | 
								return (this as any).api('notes/search', {
 | 
				
			||||||
				limit: limit + 1,
 | 
									limit: limit + 1,
 | 
				
			||||||
				offset: this.offset
 | 
									offset: this.offset,
 | 
				
			||||||
			}, parse(this.q))).then(notes => {
 | 
									query: this.q
 | 
				
			||||||
 | 
								}).then(notes => {
 | 
				
			||||||
				if (notes.length == limit + 1) {
 | 
									if (notes.length == limit + 1) {
 | 
				
			||||||
					notes.pop();
 | 
										notes.pop();
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,6 @@
 | 
				
			||||||
<script lang="ts">
 | 
					<script lang="ts">
 | 
				
			||||||
import Vue from 'vue';
 | 
					import Vue from 'vue';
 | 
				
			||||||
import Progress from '../../../common/scripts/loading';
 | 
					import Progress from '../../../common/scripts/loading';
 | 
				
			||||||
import parse from '../../../common/scripts/parse-search-query';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const limit = 20;
 | 
					const limit = 20;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,9 +46,10 @@ export default Vue.extend({
 | 
				
			||||||
			this.fetching = true;
 | 
								this.fetching = true;
 | 
				
			||||||
			Progress.start();
 | 
								Progress.start();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			(this as any).api('notes/search', Object.assign({
 | 
								(this as any).api('notes/search', {
 | 
				
			||||||
				limit: limit + 1
 | 
									limit: limit + 1,
 | 
				
			||||||
			}, parse(this.q))).then(notes => {
 | 
									query: this.q
 | 
				
			||||||
 | 
								}).then(notes => {
 | 
				
			||||||
				if (notes.length == limit + 1) {
 | 
									if (notes.length == limit + 1) {
 | 
				
			||||||
					notes.pop();
 | 
										notes.pop();
 | 
				
			||||||
					this.existMore = true;
 | 
										this.existMore = true;
 | 
				
			||||||
| 
						 | 
					@ -61,10 +61,11 @@ export default Vue.extend({
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		more() {
 | 
							more() {
 | 
				
			||||||
			this.offset += limit;
 | 
								this.offset += limit;
 | 
				
			||||||
			(this as any).api('notes/search', Object.assign({
 | 
								(this as any).api('notes/search', {
 | 
				
			||||||
				limit: limit + 1,
 | 
									limit: limit + 1,
 | 
				
			||||||
				offset: this.offset
 | 
									offset: this.offset,
 | 
				
			||||||
			}, parse(this.q))).then(notes => {
 | 
									query: this.q
 | 
				
			||||||
 | 
								}).then(notes => {
 | 
				
			||||||
				if (notes.length == limit + 1) {
 | 
									if (notes.length == limit + 1) {
 | 
				
			||||||
					notes.pop();
 | 
										notes.pop();
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue