mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-12 11:46:40 +00:00
project page connected to API without authentication. Undefined data Errors handled
This commit is contained in:
parent
4b43486c16
commit
5d0c8edacd
5 changed files with 134 additions and 142 deletions
|
|
@ -7,7 +7,9 @@ type IProps = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ActivityCollection: FC<IProps> = ({ activities, filterText }) => {
|
export const ActivityCollection: FC<IProps> = ({ activities, filterText }) => {
|
||||||
return (
|
return activities === undefined ? (
|
||||||
|
<></>
|
||||||
|
) : (
|
||||||
<>
|
<>
|
||||||
<ul className="collection">
|
<ul className="collection">
|
||||||
{activities
|
{activities
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,9 @@ interface AvatarListProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AvatarList: FC<AvatarListProps> = ({ users }) => {
|
export const AvatarList: FC<AvatarListProps> = ({ users }) => {
|
||||||
return (
|
return users === undefined ? (
|
||||||
|
<></>
|
||||||
|
) : (
|
||||||
<>
|
<>
|
||||||
{users.map((user: User, i: number) => (
|
{users.map((user: User, i: number) => (
|
||||||
<img
|
<img
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,3 +1,3 @@
|
||||||
export class Constants {
|
export class Constants {
|
||||||
static getProjectURI: string = "/api/projects";
|
static getProjectURI: string = "/api/v1/projects";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import { Ticket } from "../types/Ticket";
|
import { Ticket } from "../types/Ticket";
|
||||||
import { Project } from "../types/Project";
|
import { Project } from "../types/Project";
|
||||||
// import { Constants } from "../utils/Constants";
|
|
||||||
// import { User } from "../types/User";
|
|
||||||
import { AppFile } from "../types/AppFile";
|
import { AppFile } from "../types/AppFile";
|
||||||
import { Activity } from "../types/Activity";
|
import { Activity } from "../types/Activity";
|
||||||
import { User } from "../types/User";
|
import { User } from "../types/User";
|
||||||
|
|
@ -20,17 +18,6 @@ export default class ProjectVM {
|
||||||
public files: AppFile[];
|
public files: AppFile[];
|
||||||
public activities: Activity[];
|
public activities: Activity[];
|
||||||
|
|
||||||
/**
|
|
||||||
* getMembers
|
|
||||||
*/
|
|
||||||
// public getMembers(): string {
|
|
||||||
// let res: Promise<Response> = fetch(
|
|
||||||
// `${Constants.getProjectURI}/${this.id}/members`
|
|
||||||
// );
|
|
||||||
// return JSON.stringify(res);
|
|
||||||
// // res.json();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public constructor(project: Project) {
|
public constructor(project: Project) {
|
||||||
this.id = project.id;
|
this.id = project.id;
|
||||||
this.title = project.title;
|
this.title = project.title;
|
||||||
|
|
@ -38,8 +25,12 @@ export default class ProjectVM {
|
||||||
this.users = project.users;
|
this.users = project.users;
|
||||||
this.value = project.progression;
|
this.value = project.progression;
|
||||||
this.tickets = project.tickets;
|
this.tickets = project.tickets;
|
||||||
this.ticketsTotalCount = this.tickets.length;
|
this.ticketsTotalCount =
|
||||||
this.ticketsDone = this.tickets.filter(t => t.status === "Done").length;
|
this.tickets === undefined ? 0 : this.tickets.length;
|
||||||
|
this.ticketsDone =
|
||||||
|
this.tickets === undefined
|
||||||
|
? 0
|
||||||
|
: this.tickets.filter(t => t.status === "Done").length;
|
||||||
this.files = project.files;
|
this.files = project.files;
|
||||||
this.activities = project.activities;
|
this.activities = project.activities;
|
||||||
this.remainingDays = getRemainingdays(project.plannedEnding);
|
this.remainingDays = getRemainingdays(project.plannedEnding);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue