Browse Source

Added loading settings (no image yet) plus refactored types a little more.

world-fix
Matthew Raymer 1 year ago
parent
commit
6d3ab7c313
  1. 12
      src/views/ProjectsView.vue

12
src/views/ProjectsView.vue

@ -139,13 +139,9 @@ interface ProjectData {
}) })
export default class ProjectsView extends Vue { export default class ProjectsView extends Vue {
apiServer = ""; apiServer = "";
projects: { projects: ProjectData[] = [];
handleId: string;
name: string;
description: string;
rowid: number;
}[] = [];
current: IIdentifier; current: IIdentifier;
isLoading = false;
/** /**
* Core project data loader * Core project data loader
@ -159,6 +155,7 @@ export default class ProjectsView extends Vue {
}; };
try { try {
this.isLoading = true;
const resp = await this.axios.get(url, { headers }); const resp = await this.axios.get(url, { headers });
if (resp.status === 200) { if (resp.status === 200) {
const plans: ProjectData[] = resp.data.data; const plans: ProjectData[] = resp.data.data;
@ -169,6 +166,8 @@ export default class ProjectsView extends Vue {
} }
} catch (error) { } catch (error) {
console.error("Got error loading projects:", error); console.error("Got error loading projects:", error);
} finally {
this.isLoading = false;
} }
} }
@ -177,6 +176,7 @@ export default class ProjectsView extends Vue {
* @param payload is the flag from the InfiniteScroll indicating if it should load * @param payload is the flag from the InfiniteScroll indicating if it should load
**/ **/
async loadMoreData(payload: boolean) { async loadMoreData(payload: boolean) {
console.log(payload);
if (this.projects.length > 0) { if (this.projects.length > 0) {
const latestProject = this.projects[this.projects.length - 1]; const latestProject = this.projects[this.projects.length - 1];
const url = `${this.apiServer}/api/v2/report/plansByIssuer?beforeId=${latestProject.rowid}`; const url = `${this.apiServer}/api/v2/report/plansByIssuer?beforeId=${latestProject.rowid}`;

Loading…
Cancel
Save