Skip to content

Commit

Permalink
Merge pull request #107 from AWS-Cloud-School-6/106-feat-ec2-api-동시-호…
Browse files Browse the repository at this point in the history
…출-경우의-수-추가

#106 Feat: Ec2 API 경우의 수 추가
  • Loading branch information
nareunhang authored Nov 26, 2024
2 parents 54d5647 + f9bbef2 commit 619cc1b
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions aiwa-mcp-frontend/src/Console/Features/Instance/table/EC2Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,26 @@ function EC2Table() {
const [allEC2s, setAllEC2s] = useState([]);
const [displayedEC2s, setDisplayedEC2s] = useState([]);
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
const { currentUser, selectedCompany } = useUserContext();
const { currentUser, selectedCompany, projectId, accessKey } = useUserContext();

const openDeleteModal = () => setIsDeleteModalOpen(true);
const closeDeleteModal = () => setIsDeleteModalOpen(false);

const fetchEC2AndGCPData = async () => {
try {
const [ec2Response, gcpResponse] = await Promise.all([
axios.get(
`${AWS_API_URL}/ec2/describe?userId=${currentUser.id}&companyName=${selectedCompany}`
),
axios.get(
`${GCP_API_URL}/vm/describe?projectId=eighth-service-439605-r6&userId=${currentUser.id}`
),
accessKey
? axios.get(
`${AWS_API_URL}/ec2/describe?userId=${currentUser.id}&companyName=${selectedCompany}`
)
: Promise.resolve({data: {}}),
projectId
? axios.get(
`${GCP_API_URL}/vm/describe?projectId=${projectId}&userId=${currentUser.id}`
)
: Promise.resolve({ data: {} }), // projectId가 없으면 빈 객체를 담은 resolved Promise 반환
]);
console.log(projectId);

// EC2 데이터 처리
const processedEC2s =
Expand Down

0 comments on commit 619cc1b

Please sign in to comment.