Commit 2ba3a3dd authored by Keith Charlene Tan Esmena's avatar Keith Charlene Tan Esmena
Browse files

(#1) Show issues on page

parent 45f563f3
......@@ -6,24 +6,31 @@ import IssueView from "./components/IssueView";
function App() {
return (
<div className="App">
<header className="App-header">
<h1>Gitlab statistikk</h1>
</header>
<h3>Issues</h3>
<>
<head>
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<IssueView>
<Issue />
{/* <Issue title="KC" />
<Issue title="Anniken" />
<Issue title="Live" />
<Issue title="Janicke" /> */}
</IssueView>
<section>
<h3>Commits</h3>
<p>Legg inn det under her :)</p>
</section>
</div>
<div className="App">
<header className="App-header">
<h1>Gitlab statistikk</h1>
</header>
<h3>Issues</h3>
<IssueView>
<Issue />
</IssueView>
<section>
<h3>Commits</h3>
<p>Legg inn det under her :)</p>
</section>
</div>
</>
);
}
......
import React, { Component, useEffect, useState } from "react";
import { isUnparsedSource } from "typescript";
class Issue extends React.Component {
class Issue extends React.Component<any, any> {
constructor(props: any) {
super(props);
this.state = {
issues: [],
};
this.state = { issues: [] };
}
componentDidMount() {
......@@ -19,20 +16,18 @@ class Issue extends React.Component {
},
})
.then((result) => result.json())
.then((issues) => this.setState({ issues }));
.then((issue) => this.setState({ issues: issue }));
}
render() {
{
console.log(this.state);
}
return (
<div className="panel panel-default">
{/* <div className="panel-heading">{this.state.title}</div>
<div className="panel-body"></div>
<div>{this.state.id}</div> */}
{/* <ul>{this.state.issues}</ul> */}
{/* <p>{this.state.issues[0]}</p> */}
<div>
{this.state.issues.map((issue: { title: string; id: number }) => (
<div className="panel panel-default">
<div className="panel-heading">{issue.title}</div>
<div className="panel-body">{issue.id}</div>
</div>
))}
</div>
);
}
......
import React, { Component } from "react";
class IssueView extends React.Component<{}> {
// state = {
// issues: [],
// };
// componentDidMount() {
// console.log("Hei");
// let token = "3Nhst8cnMWx5puz8KEzR";
// fetch("https://gitlab.stud.idi.ntnu.no/api/v4/projects/11882/issues", {
// headers: {
// Authorization: `Bearer ${token}`,
// method: "GET",
// },
// })
// .then((response) => {
// if (response.ok) {
// console.log("Hallo??");
// return response.json();
// }
// throw response;
// })
// .then((data) => {
// console.log(data);
// this.setState({ issues: data });
// })
// .catch((error) => {
// console.error("Error fetching data: ", error);
// });
// }
render() {
return (
<>
<head>
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<div id="issueBox">{this.props.children}</div>
<div className="issues">
<h3>Issues</h3>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment