Skip to content

Commit

Permalink
Test API component
Browse files Browse the repository at this point in the history
  • Loading branch information
Evomatic committed Aug 7, 2023
1 parent 48801d7 commit b265062
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 12 deletions.
49 changes: 49 additions & 0 deletions src/components/ApiiComponent/ApiComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React, { useState, useEffect } from 'react';
import axios from 'axios';

const ApiComponent = () => {
const [issues, setIssues] = useState([{key: 0, fields: {summary: ''}}]);

useEffect(() => {
// Your Jira instance URL
const jiraBaseUrl = 'https://jack-uxpin.atlassian.net';
// Your Jira project key
const projectKey = 'TODO';
// Replace 'YOUR_USERNAME' and 'YOUR_API_TOKEN' with your Jira credentials
const username = '[email protected]';
const apiToken = 'ATCTT3xFfGN0bbJjSkAchXRHSFT3JYSvq34gWVz7WMtLES-qhqow8RbMmyLw4hGLyU_D0wQA4DmKkM8q4VnNXe5CBa_pgaVJPMxzkKz7-vKRp4mKFXPWhQTaFgWhv1J55SxZpWf8wxFzAPco9djDqlReeh3maPoKGUhBoTlXW5HmV4-n3j0zltU=1E2FFA88';
const auth = btoa(`${username}:${apiToken}`);

const fetchIssues = async () => {
try {
const response = await axios.get(
`${jiraBaseUrl}/rest/api/2/search?jql=project=${projectKey}`,
{
headers: {
Authorization: `Basic ${auth}`,
},
}
);

setIssues(response.data.issues);
} catch (error) {
console.error('Error fetching Jira issues:', error);
}
};

fetchIssues();
}, []);

return (
<div>
<h1>Jira Issues</h1>
<ul>
{issues.map((issue) => (
<li key={issue.key}>{issue.fields.summary}</li>
))}
</ul>
</div>
);
};

export default ApiComponent;
25 changes: 13 additions & 12 deletions uxpin.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@ module.exports = {
{
name: 'General',
include: [
'src/components/Button/Button.tsx',
'src/components/Calendar/Calendar.tsx',
'src/components/DynamicTable/DynamicTable.tsx',
'src/components/Select/Select.tsx',
'src/components/Checkbox/Checkbox.tsx',
'src/components/Toggle/Toggle.tsx',
'src/components/TextArea/TextArea.tsx',
'src/components/Radio/Radio.tsx',
'src/components/PageLayout/PageLayout.tsx',
'src/components/Navigation/Navigation.tsx',
'src/components/PrimaryButton/PrimaryButton.tsx'
// 'src/components/Button/Button.tsx',
// 'src/components/Calendar/Calendar.tsx',
// 'src/components/DynamicTable/DynamicTable.tsx',
// 'src/components/Select/Select.tsx',
// 'src/components/Checkbox/Checkbox.tsx',
// 'src/components/Toggle/Toggle.tsx',
// 'src/components/TextArea/TextArea.tsx',
// 'src/components/Radio/Radio.tsx',
// 'src/components/PageLayout/PageLayout.tsx',
// 'src/components/Navigation/Navigation.tsx',
// 'src/components/PrimaryButton/PrimaryButton.tsx',
'src/components/ApiiComponent/ApiComponent.tsx'
],
},
{
name: 'Icons',
include: [
'src/components/AddCircleIcon/AddCircleIcon.tsx'
// 'src/components/AddCircleIcon/AddCircleIcon.tsx'
],
},
],
Expand Down

0 comments on commit b265062

Please sign in to comment.