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 13365f7
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"@types/react": "^18.2.17",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/parser": "^6.2.0",
"@uxpin/merge-cli": "3.3.0-atlas-dev.147",
"@uxpin/merge-cli": "^3.2.0",
"axios": "^1.4.0",
"babel-loader": "^9.1.3",
"css-loader": "^6.8.1",
"eslint": "^8.46.0",
Expand Down
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
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2018,10 +2018,10 @@
"@typescript-eslint/types" "6.2.0"
eslint-visitor-keys "^3.4.1"

"@uxpin/merge-cli@3.3.0-atlas-dev.147":
version "3.3.0-atlas-dev.147"
resolved "https://registry.yarnpkg.com/@uxpin/merge-cli/-/merge-cli-3.3.0-atlas-dev.147.tgz#16dadcb3b08090992c1b4ebeecf4654cfc802d8b"
integrity sha512-qTZki9LLMMPqw50857938FneSkrcftzxcEjSjisL0zbqr2+7cWn6C7SsOBe2UoxRZFKcDm4fdf5aBJFRMSeTTQ==
"@uxpin/merge-cli@^3.2.0":
version "3.3.0"
resolved "https://npm.pkg.github.com/download/@UXPin/merge-cli/3.3.0/519ad38ef5de681e1a5dce128e15a5e20e5bc29c#519ad38ef5de681e1a5dce128e15a5e20e5bc29c"
integrity sha512-9tRYinNDB4j6emUNBAWhJbKDuUH2h4qtSrCk+eWRVwx/tnsDbis5/a1v/LeK+vPBvMjEVMpO6UUBkg8eX92MNw==
dependencies:
"@babel/core" "^7.21.8"
"@babel/plugin-proposal-class-properties" "^7.2.3"
Expand Down Expand Up @@ -2065,7 +2065,7 @@
sortobject "^1.1.1"
source-map-support "^0.4.18"
tslib "^1.9.0"
typescript "4.8.4"
typescript "4.4.2"
uuid "^3.3.2"
webpack-merge "^4.1.2"
webpack-virtual-modules "^0.5.0"
Expand Down Expand Up @@ -4859,10 +4859,10 @@ type-fest@^0.20.2:
resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==

typescript@4.8.4:
version "4.8.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6"
integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==
typescript@4.4.2:
version "4.4.2"
resolved "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz#6d618640d430e3569a1dfb44f7d7e600ced3ee86"
integrity sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==

typescript@^3.1.3:
version "3.9.10"
Expand Down

0 comments on commit 13365f7

Please sign in to comment.