forked from jsnbuchanan/crowd-funder-for-time-pwa
Added loading settings (no image yet) plus refactored types a little more.
This commit is contained in:
@@ -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}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user