diff options
Diffstat (limited to 'frontend/src')
-rw-r--r-- | frontend/src/App.css | 0 | ||||
-rw-r--r-- | frontend/src/App.js | 14 | ||||
-rw-r--r-- | frontend/src/App.test.js | 8 | ||||
-rw-r--r-- | frontend/src/Button.js | 9 | ||||
-rw-r--r-- | frontend/src/SECAPIData.js | 95 | ||||
-rw-r--r-- | frontend/src/index.js | 16 | ||||
-rw-r--r-- | frontend/src/reportWebVitals.js | 13 | ||||
-rw-r--r-- | frontend/src/setupTests.js | 5 |
8 files changed, 0 insertions, 160 deletions
diff --git a/frontend/src/App.css b/frontend/src/App.css deleted file mode 100644 index e69de29..0000000 --- a/frontend/src/App.css +++ /dev/null diff --git a/frontend/src/App.js b/frontend/src/App.js deleted file mode 100644 index cf89bf0..0000000 --- a/frontend/src/App.js +++ /dev/null @@ -1,14 +0,0 @@ -import './App.css'; -import SECAPIData from "./SECAPIData"; - -function App() { - - return ( - <div className="App"> - <SECAPIData></SECAPIData> - </div> - ); -} - -export default App; - diff --git a/frontend/src/App.test.js b/frontend/src/App.test.js deleted file mode 100644 index 1f03afe..0000000 --- a/frontend/src/App.test.js +++ /dev/null @@ -1,8 +0,0 @@ -import { render, screen } from '@testing-library/react'; -import App from './App'; - -test('renders learn react link', () => { - render(<App />); - const linkElement = screen.getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); -}); diff --git a/frontend/src/Button.js b/frontend/src/Button.js deleted file mode 100644 index 9aba266..0000000 --- a/frontend/src/Button.js +++ /dev/null @@ -1,9 +0,0 @@ -import { AwesomeButton } from "react-awesome-button"; -import "react-awesome-button/dist/styles.css"; - - -function Button(props) { - return <AwesomeButton type="primary" onPress={props.onPress}>GET DATA</AwesomeButton>; -} - -export default Button;
\ No newline at end of file diff --git a/frontend/src/SECAPIData.js b/frontend/src/SECAPIData.js deleted file mode 100644 index b1b4939..0000000 --- a/frontend/src/SECAPIData.js +++ /dev/null @@ -1,95 +0,0 @@ -import React, {useState, useEffect} from 'react'; -import Button from './Button'; - - - -function SECAPIData() { - - const [dataToBackend, setDataToBackend] = useState([]); - const [displayData, setDisplayData] = useState(""); - - const requestData = () => { - // End early in debug to avoid too many requests. - if (dataToBackend.length !== 0) { - sendToBackend(); - return; - } - - console.log("Makig request..."); - - let date = new Date() - let today = date.toISOString().slice(0, 10); - - let pastDate = new Date(); - pastDate.setDate(date.getDate() - 14); - let past = pastDate.toISOString().slice(0, 10); - - fetch("https://api.sec-api.io?token=4d6ff81353d665c975d443e30020879b1ea882bc96a00cd8774a95bddd838fe5", { - method: "POST", - body: JSON.stringify({ - "query": { "query_string": { "query": "formType:4 AND filedAt:{"+ past +" TO "+ today +"} AND formType:(NOT \"N-4\") AND formType:(NOT \"4/A\")" } }, - "from": "0", - "size": "1000", - "sort": [{ "filedAt": { "order": "desc" } }] - }), - headers: { - "Content-Type": "application/json" - }, - credentials: "same-origin" - }) - .then(res => res.json()) - .then(data => { - let list = []; - data.filings.forEach(filing => { - if (filing.ticker === "") { - // TODO: why are there repitions of urls. - list.push({ - timestamp: filing.filedAt, - url: filing.documentFormatFiles[1].documentUrl - }); - } - }) - setDataToBackend(list); - }) - .catch(error => { - console.log(error); - }); - } - - const sendToBackend = () => { - console.log(dataToBackend); - - fetch("http://localhost:4567/data", { - method: "POST", - body: JSON.stringify({ - "data" : dataToBackend - }), - headers: { - "Content-Type": "application/json", - }, - credentials: "same-origin" - }) - - .then(response => { - setDisplayData(JSON.stringify(response)); - console.log(response); - }) - .catch(function (error) { - console.log(error); - }); - } - - // This hook is autocalled once the setDataToBackend takes effect. - useEffect(() => sendToBackend(), [dataToBackend]); - - return ( - <div> - <h1>SECAPIData</h1> - <Button onPress={requestData}></Button> - <p>DISPLAY DATA: {displayData}</p> - </div> - ); -} - -export default SECAPIData; -
\ No newline at end of file diff --git a/frontend/src/index.js b/frontend/src/index.js deleted file mode 100644 index 7998135..0000000 --- a/frontend/src/index.js +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import App from './App'; -import reportWebVitals from './reportWebVitals'; - -ReactDOM.render( - <React.StrictMode> - <App /> - </React.StrictMode>, - document.getElementById('root') -); - -// If you want to start measuring performance in your app, pass a function -// to log results (for example: reportWebVitals(console.log)) -// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(); diff --git a/frontend/src/reportWebVitals.js b/frontend/src/reportWebVitals.js deleted file mode 100644 index 5253d3a..0000000 --- a/frontend/src/reportWebVitals.js +++ /dev/null @@ -1,13 +0,0 @@ -const reportWebVitals = onPerfEntry => { - if (onPerfEntry && onPerfEntry instanceof Function) { - import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); - }); - } -}; - -export default reportWebVitals; diff --git a/frontend/src/setupTests.js b/frontend/src/setupTests.js deleted file mode 100644 index 8f2609b..0000000 --- a/frontend/src/setupTests.js +++ /dev/null @@ -1,5 +0,0 @@ -// jest-dom adds custom jest matchers for asserting on DOM nodes. -// allows you to do things like: -// expect(element).toHaveTextContent(/react/i) -// learn more: https://github.com/testing-library/jest-dom -import '@testing-library/jest-dom'; |