Skip to content
Snippets Groups Projects
Commit 97f12a38 authored by Michael Utama's avatar Michael Utama
Browse files

fix: missing history

parent 78831814
Branches
Tags
No related merge requests found
import React from "react"; import React, { FC, useEffect, useState } from "react";
import { ToastContainer } from "react-toastify"; import { ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css"; import "react-toastify/dist/ReactToastify.css";
import { FaWallet, FaPlus } from 'react-icons/fa6'; import { FaWallet, FaPlus } from 'react-icons/fa6';
import HistorySingle from './HistorySingle'; import HistorySingle from './HistorySingle';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import axios from "axios";
import { REST_BASE_URL } from "@/constant/constants";
const History = () => { const History = () => {
const navigate = useNavigate(); const navigate = useNavigate();
...@@ -13,6 +15,26 @@ const History = () => { ...@@ -13,6 +15,26 @@ const History = () => {
navigate(yourRoute); navigate(yourRoute);
}; };
const [userHistory, setUserHistory] = useState<any>();
useEffect(() => {
const userID = 1;
const fetchData = async () => {
const userHistoryData = await axios.get(
REST_BASE_URL + '/history/get/' + userID
);
setUserHistory(userHistoryData.data);
}
fetchData();
console.log(userHistory);
}, []);
return ( return (
<> <>
<ToastContainer /> <ToastContainer />
...@@ -44,6 +66,16 @@ const History = () => { ...@@ -44,6 +66,16 @@ const History = () => {
</div> </div>
</div> </div>
<div className="relative top-16 mb-4"> <div className="relative top-16 mb-4">
{userHistory && userHistory.map((element, index: number) => (
<HistorySingle
key={index}
status={element.status}
title={element.info}
subtitle={element.reciever}
amount={'Rp ' + new Intl.NumberFormat('id-ID').format(element.amount)}
/>
))}
<HistorySingle <HistorySingle
status="Berhasil" status="Berhasil"
title="Transfer ke" title="Transfer ke"
......
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