diff --git a/src/App.js b/src/App.js
index 113567f..644ba0e 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,7 +1,28 @@
import './App.css';
+import './calculateCreditsAndRebates';
import { useState, useEffect } from 'react';
+// TODO: create one of these objects in household component
+class HouseholdInfo {
+ constructor({married, numChildren, zipCode, income}) {
+ this.married = married;
+ this.numChildren = numChildren;
+ this.zipCode = zipCode;
+ this.income = income;
+ }
+}
+
function App() {
+ // TODO: begin with a null household in the PR that creates Household component.
+ // This is just placeholder data for now
+ const [household, setHousehold] = useState(new HouseholdInfo({
+ married: true,
+ numChildren: 3,
+ zipCode: 98102,
+ income: 50000,
+ }));
+ console.log(household, setHousehold);
+
return (
@@ -27,25 +48,10 @@ const exampleHousehold = {
function APIExampleTest() {
const [rebateAmount, setRebateAmount] = useState(null);
-
+
useEffect(() => {
- fetch(
- "https://policyengine.org/us/api/calculate", {
- method: 'POST',
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- household: exampleHousehold,
- })
- }
- )
- .then(results => results.json())
- .then(data => {
- const rebateAmount = data.tax_units.tax_unit.capped_heat_pump_rebate[2023];
- setRebateAmount(rebateAmount);
- });
+ const moneySavedInfo = calculateCreditsAndRebates();
+ console.log('TODO: move this function call to the right place', moneySavedInfo);
}, []); // <-- Have to pass in [] here!
if(rebateAmount === null) {
diff --git a/src/calculateCreditsAndRebates.js b/src/calculateCreditsAndRebates.js
new file mode 100644
index 0000000..d31e4ce
--- /dev/null
+++ b/src/calculateCreditsAndRebates.js
@@ -0,0 +1,11 @@
+// householdInfo and expenditures data structures are going to be defined in App.js
+export default function ({householdInfo, expenditures}) {
+ // Need to call API and return this info for real.
+ return {
+ credits: 10000,
+ rebates: {
+ min: 800,
+ max: 4200,
+ }
+ };
+}