Browse Source

fix local & remote search to work, fix beforeId check, fix handleId setting

pull/41/head
Trent Larson 1 year ago
parent
commit
2493f2ad39
  1. 15
      src/views/DiscoverView.vue

15
src/views/DiscoverView.vue

@ -164,14 +164,11 @@ export default class DiscoverView extends Vue {
} }
public async search(beforeId?: string) { public async search(beforeId?: string) {
const claimContents = let queryParams = "claimContents=" + encodeURIComponent(this.searchTerms);
"claimContents=" + encodeURIComponent(this.searchTerms);
const claimType = "claimType=PlanAction";
let queryParams = [claimContents, claimType].join("&");
console.log(beforeId); console.log(beforeId);
if (beforeId) { if (beforeId) {
queryParams = queryParams + `beforeId=${beforeId}`; queryParams = queryParams + `&beforeId=${beforeId}`;
} }
this.isRemoteActive = true; this.isRemoteActive = true;
@ -180,7 +177,7 @@ export default class DiscoverView extends Vue {
try { try {
this.isLoading = true; this.isLoading = true;
const response = await fetch( const response = await fetch(
this.apiServer + "/api/v2/report/claims?" + queryParams, this.apiServer + "/api/v2/report/plans?" + queryParams,
{ {
method: "GET", method: "GET",
headers: await this.buildHeaders(), headers: await this.buildHeaders(),
@ -197,7 +194,7 @@ export default class DiscoverView extends Vue {
const plans: ProjectData[] = results.data; const plans: ProjectData[] = results.data;
if (plans) { if (plans) {
for (const plan of plans) { for (const plan of plans) {
const { name, description, handleId = plan.fullIri, rowid } = plan; const { name, description, handleId = plan.handleId, rowid } = plan;
console.log("here"); console.log("here");
this.projects.push({ name, description, handleId, rowid }); this.projects.push({ name, description, handleId, rowid });
} }
@ -227,7 +224,7 @@ export default class DiscoverView extends Vue {
].join("&"); ].join("&");
if (beforeId) { if (beforeId) {
queryParams = queryParams + `beforeId=${beforeId}`; queryParams = queryParams + `&beforeId=${beforeId}`;
} }
try { try {
@ -252,7 +249,7 @@ export default class DiscoverView extends Vue {
if (beforeId) { if (beforeId) {
const plans: ProjectData[] = results.data; const plans: ProjectData[] = results.data;
for (const plan of plans) { for (const plan of plans) {
const { name, description, handleId = plan.fullIri, rowid } = plan; const { name, description, handleId = plan.handleId, rowid } = plan;
if (beforeId !== plan["rowid"]) { if (beforeId !== plan["rowid"]) {
this.projects.push({ name, description, handleId, rowid }); this.projects.push({ name, description, handleId, rowid });
} }

Loading…
Cancel
Save