{"version":3,"sources":["store/User.ts","store/Accounts.ts","store/Transactions.ts","store/index.ts","store/Counter.ts","components/LoginStatus.tsx","components/NavMenu.tsx","components/Layout.tsx","components/Home.tsx","components/Accounts.tsx","Styles.tsx","components/TextInput.tsx","components/NumberInput.tsx","components/Register.tsx","components/Deposit.tsx","components/Withdraw.tsx","components/Transactions.tsx","App.tsx","registerServiceWorker.ts","index.tsx","store/configureStore.ts"],"names":["actionCreators","requestLogin","dispatch","getState","fetch","then","response","status","type","isLoggedIn","catch","err","requestAccounts","json","data","accounts","unloadedState","requestTransactions","accountId","transactionState","account","credits","debits","currentBalance","reducers","counter","state","incomingAction","undefined","count","user","action","accountDetails","LoginStatus","this","ensureDataFetched","props","window","location","href","NavItem","NavLink","tag","Link","className","to","onClick","logout","bind","loginWithGitHub","loginWithGoogle","React","connect","UserStore","NavMenu","isOpen","toggle","setState","Navbar","light","Container","NavbarBrand","NavbarToggler","Collapse","navbar","children","Accounts","aria-labelledby","map","key","AccountsStore","btn","dark","css","btnDefault","btnPrimary","styled","div","TextInput","input","rest","meta","NumberInput","onSubmit","values","a","formData","FormData","append","firstName","ssn","initialAmount","toString","method","body","Styles","initialValues","render","handleSubmit","submitting","form","pristine","name","component","placeholder","disabled","Deposit","match","params","amount","PureComponent","Withdraw","Transactions","console","log","transaction","transactionId","description","transactionDate","TransactionsStore","Layout","exact","path","Home","Register","isLocalhost","Boolean","hostname","registerValidSW","swUrl","navigator","serviceWorker","register","registration","onupdatefound","installingWorker","installing","onstatechange","controller","error","baseUrl","document","getElementsByTagName","getAttribute","history","createBrowserHistory","basename","store","initialState","middleware","thunk","routerMiddleware","rootReducer","combineReducers","router","connectRouter","enhancers","windowIfDefined","__REDUX_DEVTOOLS_EXTENSION__","push","createStore","compose","applyMiddleware","configureStore","ReactDOM","App","getElementById","URL","process","origin","addEventListener","contentType","headers","get","indexOf","ready","unregister","reload","checkValidServiceWorker","registerServiceWorker"],"mappings":"iRAgCaA,EAAiB,CAC1BC,aAAc,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qC,IADVC,GACmBnI,OAAOC,SAASsD,YACjC6E,SAAWpI,OAAOC,SAASmI,OAIrC,OAGJpI,OAAOqI,iBAAiB,QAAQ,WAC5B,IAAMzC,EAAK,UAAMuC,GAAN,sBAEP3C,GAwChB,SAAiCI,GAE7B7H,MAAM6H,GACD5H,MAAK,SAAAC,GAEF,IAAMqK,EAAcrK,EAASsK,QAAQC,IAAI,gBACjB,MAApBvK,EAASC,QAAmBoK,IAAsD,IAAvCA,EAAYG,QAAQ,cAE/D5C,UAAUC,cAAc4C,MAAM1K,MAAK,SAAAgI,GAC/BA,EAAa2C,aAAa3K,MAAK,WAC3BgC,OAAOC,SAAS2I,eAKxBjD,GAAgBC,MAGvBvH,OAAM,WACHuG,QAAQC,IAAI,oEAzDRgE,CAAwBjD,GAGxBD,GAAgBC,OCdhCkD,K","file":"static/js/main.245a20c7.chunk.js","sourcesContent":["import { Action, Reducer } from 'redux';\r\nimport {AppThunkAction} from \"./index\";\r\n\r\n// -----------------\r\n// STATE - This defines the type of data maintained in the Redux store.\r\n\r\nexport interface UserState {\r\n isLoggedIn: boolean;\r\n}\r\n\r\n// -----------------\r\n// ACTIONS - These are serializable (hence replayable) descriptions of state transitions.\r\n// They do not themselves have any side-effects; they just describe something that is going to happen.\r\n// Use @typeName and isActionType for type detection that works even after serialization/deserialization.\r\n\r\nexport interface RequestLoginAction {\r\n type: 'REQUEST_LOGIN'\r\n}\r\n\r\nexport interface ReceiveLoginAction {\r\n type: 'RECEIVE_LOGIN';\r\n isLoggedIn: boolean;\r\n}\r\n\r\n// Declare a 'discriminated union' type. This guarantees that all references to 'type' properties contain one of the\r\n// declared type strings (and not any other arbitrary string).\r\nexport type KnownAction = RequestLoginAction | ReceiveLoginAction;\r\n\r\n// ----------------\r\n// ACTION CREATORS - These are functions exposed to UI components that will trigger a state transition.\r\n// They don't directly mutate state, but they can have external side-effects (such as loading data).\r\n\r\nexport const actionCreators = {\r\n requestLogin: (): AppThunkAction => (dispatch, getState) => {\r\n fetch(`api/v1/Login/GetUserInfo`)\r\n .then((response) => {\r\n if(response.status === 200){\r\n dispatch({ type: 'RECEIVE_LOGIN', isLoggedIn: true });\r\n } else if(response.status === 401){\r\n dispatch({ type: 'RECEIVE_LOGIN', isLoggedIn: false });\r\n }\r\n })\r\n .catch((err)=>{\r\n dispatch({ type: 'RECEIVE_LOGIN', isLoggedIn: false });\r\n });\r\n }\r\n};\r\n\r\n// ----------------\r\n// REDUCER - For a given state and action, returns the new state. To support time travel, this must not mutate the old state.\r\n\r\nexport const reducer: Reducer = (state: UserState | undefined, incomingAction: Action): UserState => {\r\n if (state === undefined) {\r\n return { isLoggedIn: false };\r\n }\r\n\r\n const action = incomingAction as KnownAction;\r\n switch (action.type) {\r\n case 'RECEIVE_LOGIN':\r\n return { isLoggedIn: action.isLoggedIn };\r\n default:\r\n return state;\r\n }\r\n};\r\n","import { Action, Reducer } from \"redux\";\r\nimport { AppThunkAction } from \"./\";\r\n\r\nexport interface AccountsState {\r\n accounts: Accounts;\r\n}\r\n\r\nexport interface Accounts {\r\n accounts: Account[];\r\n}\r\n\r\nexport interface Account {\r\n accountId: string;\r\n currentBalance: number;\r\n}\r\n\r\ninterface RequestAccountsAction {\r\n type: \"REQUEST_ACCOUNTS\";\r\n}\r\n\r\ninterface ReceiveAccountsAction {\r\n type: \"RECEIVE_ACCOUNTS\";\r\n accounts: Accounts;\r\n}\r\n\r\ntype KnownAction = RequestAccountsAction | ReceiveAccountsAction;\r\n\r\nexport const actionCreators = {\r\n requestAccounts: (): AppThunkAction => (\r\n dispatch,\r\n getState\r\n ) => {\r\n fetch(`api/v1/Accounts`)\r\n .then((response) => response.json() as Promise)\r\n .then((data) => {\r\n dispatch({ type: \"RECEIVE_ACCOUNTS\", accounts: data });\r\n });\r\n },\r\n};\r\n\r\nconst unloadedState: AccountsState = { accounts: { accounts: [] } };\r\n\r\nexport const reducer: Reducer = (\r\n state: AccountsState | undefined,\r\n incomingAction: Action\r\n): AccountsState => {\r\n if (state === undefined) {\r\n return unloadedState;\r\n }\r\n\r\n const action = incomingAction as KnownAction;\r\n switch (action.type) {\r\n case \"RECEIVE_ACCOUNTS\":\r\n return {\r\n accounts: action.accounts,\r\n };\r\n break;\r\n }\r\n\r\n return state;\r\n};\r\n","import { Action, Reducer } from \"redux\";\r\nimport { AppThunkAction } from \"./\";\r\n\r\nexport interface TransactionsState {\r\n account: AccountDetails;\r\n}\r\n\r\nexport interface AccountDetails {\r\n accountId: string;\r\n currentBalance: number;\r\n credits: Credit[];\r\n debits: Debit[];\r\n}\r\n\r\nexport interface Credit {\r\n transactionId: string;\r\n amount: number;\r\n description: string;\r\n transactionDate: Date;\r\n}\r\n\r\nexport interface Debit {\r\n transactionId: string;\r\n amount: number;\r\n description: string;\r\n transactionDate: Date;\r\n}\r\n\r\ninterface RequestTransactionsAction {\r\n type: \"REQUEST_TRANSACTIONS\";\r\n}\r\n\r\ninterface ReceiveTransactionsAction {\r\n type: \"RECEIVE_TRANSACTIONS\";\r\n transactionState: TransactionsState;\r\n}\r\n\r\ntype KnownAction = RequestTransactionsAction | ReceiveTransactionsAction;\r\n\r\nexport const actionCreators = {\r\n requestTransactions: (accountId: string): AppThunkAction => (\r\n dispatch,\r\n getState\r\n ) => {\r\n fetch(`api/v1/Accounts/${accountId}`)\r\n .then((response) => response.json() as Promise)\r\n .then((data) => {\r\n dispatch({\r\n type: \"RECEIVE_TRANSACTIONS\",\r\n transactionState: data,\r\n });\r\n });\r\n },\r\n};\r\n\r\nconst unloadedState: TransactionsState = {\r\n account: { credits: [], debits: [], accountId: \"\", currentBalance: 0 },\r\n};\r\n\r\nexport const reducer: Reducer = (\r\n state: TransactionsState | undefined,\r\n incomingAction: Action\r\n): TransactionsState => {\r\n if (state === undefined) {\r\n return unloadedState;\r\n }\r\n\r\n const action = incomingAction as KnownAction;\r\n switch (action.type) {\r\n case \"RECEIVE_TRANSACTIONS\":\r\n return action.transactionState;\r\n break;\r\n }\r\n\r\n return state;\r\n};\r\n","import * as Counter from \"./Counter\";\r\nimport * as User from \"./User\";\r\nimport * as Accounts from \"./Accounts\";\r\nimport * as Transactions from \"./Transactions\";\r\n\r\n// The top-level state object\r\nexport interface ApplicationState {\r\n counter: Counter.CounterState | undefined;\r\n user: User.UserState | undefined;\r\n accounts: Accounts.AccountsState | undefined;\r\n accountDetails: Transactions.TransactionsState | undefined;\r\n}\r\n\r\n// Whenever an action is dispatched, Redux will update each top-level application state property using\r\n// the reducer with the matching name. It's important that the names match exactly, and that the reducer\r\n// acts on the corresponding ApplicationState property type.\r\nexport const reducers = {\r\n counter: Counter.reducer,\r\n user: User.reducer,\r\n accounts: Accounts.reducer,\r\n accountDetails: Transactions.reducer,\r\n};\r\n\r\n// This type can be used as a hint on action creators so that its 'dispatch' and 'getState' params are\r\n// correctly typed to match your store.\r\nexport interface AppThunkAction {\r\n (\r\n dispatch: (action: TAction) => void,\r\n getState: () => ApplicationState\r\n ): void;\r\n}\r\n","import { Action, Reducer } from 'redux';\r\n\r\n// -----------------\r\n// STATE - This defines the type of data maintained in the Redux store.\r\n\r\nexport interface CounterState {\r\n count: number;\r\n}\r\n\r\n// -----------------\r\n// ACTIONS - These are serializable (hence replayable) descriptions of state transitions.\r\n// They do not themselves have any side-effects; they just describe something that is going to happen.\r\n// Use @typeName and isActionType for type detection that works even after serialization/deserialization.\r\n\r\nexport interface IncrementCountAction { type: 'INCREMENT_COUNT' }\r\nexport interface DecrementCountAction { type: 'DECREMENT_COUNT' }\r\n\r\n// Declare a 'discriminated union' type. This guarantees that all references to 'type' properties contain one of the\r\n// declared type strings (and not any other arbitrary string).\r\nexport type KnownAction = IncrementCountAction | DecrementCountAction;\r\n\r\n// ----------------\r\n// ACTION CREATORS - These are functions exposed to UI components that will trigger a state transition.\r\n// They don't directly mutate state, but they can have external side-effects (such as loading data).\r\n\r\nexport const actionCreators = {\r\n increment: () => ({ type: 'INCREMENT_COUNT' } as IncrementCountAction),\r\n decrement: () => ({ type: 'DECREMENT_COUNT' } as DecrementCountAction)\r\n};\r\n\r\n// ----------------\r\n// REDUCER - For a given state and action, returns the new state. To support time travel, this must not mutate the old state.\r\n\r\nexport const reducer: Reducer = (state: CounterState | undefined, incomingAction: Action): CounterState => {\r\n if (state === undefined) {\r\n return { count: 0 };\r\n }\r\n\r\n const action = incomingAction as KnownAction;\r\n switch (action.type) {\r\n case 'INCREMENT_COUNT':\r\n return { count: state.count + 1 };\r\n case 'DECREMENT_COUNT':\r\n return { count: state.count - 1 };\r\n default:\r\n return state;\r\n }\r\n};\r\n","import * as React from 'react';\r\nimport { connect } from 'react-redux';\r\nimport { ApplicationState } from '../store';\r\nimport * as UserStore from '../store/User';\r\nimport {Link} from \"react-router-dom\";\r\nimport {NavItem, NavLink} from \"reactstrap\";\r\n\r\ntype UserProps =\r\n UserStore.UserState &\r\n typeof UserStore.actionCreators;\r\n\r\nclass LoginStatus extends React.PureComponent {\r\n public componentDidMount() {\r\n this.ensureDataFetched();\r\n }\r\n\r\n // This method is called when the route parameters change\r\n public componentDidUpdate() {\r\n this.ensureDataFetched();\r\n }\r\n\r\n private ensureDataFetched() {\r\n this.props.requestLogin();\r\n }\r\n\r\n loginWithGitHub() {\r\n window.location.href = \"/api/v1/Login/GitHub?ReturnUrl=\" + window.location.href;\r\n }\r\n\r\n loginWithGoogle() {\r\n window.location.href = \"/api/v1/Login/Google?ReturnUrl=\" + window.location.href;\r\n }\r\n\r\n logout() {\r\n window.location.href = \"/api/v1/Logout?ReturnUrl=\" + window.location.href;\r\n }\r\n\r\n public render() {\r\n if (this.props.isLoggedIn) {\r\n return (\r\n \r\n \r\n Manage Accounts\r\n \r\n \r\n Logout\r\n \r\n \r\n )\r\n }\r\n else\r\n {\r\n return (\r\n \r\n \r\n Login with GitHub\r\n \r\n \r\n Login with Google\r\n \r\n \r\n )\r\n }\r\n }\r\n}\r\n\r\nexport default connect(\r\n (state: ApplicationState) => state.user,\r\n UserStore.actionCreators\r\n)(LoginStatus as any);\r\n","import * as React from 'react';\r\nimport { Collapse, Container, Navbar, NavbarBrand, NavbarToggler, NavItem, NavLink } from 'reactstrap';\r\nimport { Link } from 'react-router-dom';\r\nimport './NavMenu.css';\r\nimport LoginStatus from './LoginStatus';\r\n\r\nexport default class NavMenu extends React.PureComponent<{}, { isOpen: boolean }> {\r\n public state = {\r\n isOpen: false\r\n };\r\n\r\n public render() {\r\n return (\r\n
\r\n \r\n \r\n Clean Architecture Manga\r\n \r\n \r\n
    \r\n \r\n Home\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n );\r\n }\r\n\r\n private toggle = () => {\r\n this.setState({\r\n isOpen: !this.state.isOpen\r\n });\r\n }\r\n}\r\n","import * as React from 'react';\r\nimport { Container } from 'reactstrap';\r\nimport NavMenu from './NavMenu';\r\n\r\nexport default (props: { children?: React.ReactNode }) => (\r\n \r\n \r\n \r\n {props.children}\r\n \r\n \r\n);\r\n","import * as React from 'react';\r\nimport { connect } from 'react-redux';\r\n\r\nconst Home = () => (\r\n
\r\n

Hello, world!

\r\n

Welcome to your new single-page application, built with:

\r\n \r\n

To help you get started, we've also set up:

\r\n
    \r\n
  • Client-side navigation. For example, click Counter then Back to return here.
  • \r\n
  • Development server integration. In development mode, the development server from create-react-app runs in the background automatically, so your client-side resources are dynamically built on demand and the page refreshes when you modify any file.
  • \r\n
  • Efficient production builds. In production mode, development-time features are disabled, and your dotnet publish configuration produces minified, efficiently bundled JavaScript files.
  • \r\n
\r\n

The ClientApp subdirectory is a standard React application based on the create-react-app template. If you open a command prompt in that directory, you can run npm commands such as npm test or npm install.

\r\n
\r\n);\r\n\r\nexport default connect()(Home);\r\n","import * as React from 'react';\r\nimport { connect } from 'react-redux';\r\nimport { ApplicationState } from '../store';\r\nimport * as AccountsStore from '../store/Accounts';\r\nimport { Link } from \"react-router-dom\";\r\nimport { NavLink } from \"reactstrap\";\r\n\r\ntype AccountsProps =\r\n AccountsStore.AccountsState\r\n & typeof AccountsStore.actionCreators;\r\n\r\n\r\nclass Accounts extends React.PureComponent {\r\n public componentDidMount() {\r\n this.ensureDataFetched();\r\n }\r\n\r\n public render() {\r\n return (\r\n \r\n

Manage Accounts

\r\n

All your checking accounts.

\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {this.props.accounts.accounts.map((account: AccountsStore.Account) =>\r\n \r\n \r\n \r\n \r\n )}\r\n \r\n
AccountCurrent Balance
Transactions {account.currentBalance}
\r\n
\r\n );\r\n }\r\n\r\n private ensureDataFetched() {\r\n this.props.requestAccounts();\r\n }\r\n}\r\n\r\nexport default connect(\r\n (state: ApplicationState) => state.accounts,\r\n AccountsStore.actionCreators\r\n)(Accounts as any);\r\n","import styled, { css } from \"styled-components\";\n\nconst btn = (light: string, dark: string) => css`\n white-space: nowrap;\n display: inline-block;\n border-radius: 5px;\n padding: 5px 15px;\n font-size: 16px;\n color: white;\n &:visited {\n color: white;\n }\n background-image: linear-gradient(${light}, ${dark});\n border: 1px solid ${dark};\n &:hover {\n background-image: linear-gradient(${light}, ${dark});\n &[disabled] {\n background-image: linear-gradient(${light}, ${dark});\n }\n }\n &:visited {\n color: black;\n }\n &[disabled] {\n opacity: 0.6;\n cursor: not-allowed;\n }\n`;\n\nconst btnDefault = css`\n ${btn(\"#ffffff\", \"#d5d5d5\")} color: #555;\n`;\n\nconst btnPrimary = btn(\"#4f93ce\", \"#285f8f\");\n\nexport default styled.div`\n font-family: sans-serif;\n\n h1 {\n text-align: center;\n color: #222;\n }\n\n h2 {\n text-align: center;\n color: #222;\n }\n\n & > div {\n text-align: center;\n }\n\n p {\n text-align: center;\n }\n\n a {\n display: block;\n text-align: center;\n color: #222;\n }\n\n form {\n max-width: 500px;\n margin: 10px auto;\n border: 1px solid #ccc;\n padding: 20px;\n box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);\n border-radius: 3px;\n\n & > div {\n display: flex;\n flex-flow: row nowrap;\n line-height: 2em;\n margin: 5px;\n & > label {\n color: #333;\n width: 110px;\n font-size: 1em;\n line-height: 32px;\n }\n & > input,\n & > select,\n & > textarea {\n flex: 1;\n padding: 3px 5px;\n font-size: 1em;\n margin-left: 15px;\n border: 1px solid #ccc;\n border-radius: 3px;\n }\n & > input[type=\"checkbox\"] {\n margin-top: 7px;\n }\n & > div {\n margin-left: 16px;\n & > label {\n display: block;\n & > input {\n margin-right: 3px;\n }\n }\n }\n }\n & > .buttons {\n display: flex;\n flex-flow: row nowrap;\n justify-content: center;\n margin-top: 15px;\n }\n button {\n margin: 0 10px;\n &[type=\"submit\"] {\n ${btnPrimary};\n }\n &[type=\"button\"] {\n ${btnDefault};\n }\n }\n pre {\n border: 1px solid #ccc;\n background: rgba(0, 0, 0, 0.1);\n box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.2);\n padding: 20px;\n }\n }\n`;\n","import React from \"react\";\nimport { FieldRenderProps } from \"react-final-form\";\n\ntype Props = FieldRenderProps;\n\nconst TextInput: React.FC = ({ input, meta, ...rest }: Props) => (\n \n);\n\nexport default TextInput;\n","import React from \"react\";\nimport { FieldRenderProps } from \"react-final-form\";\n\ntype Props = FieldRenderProps;\n\nconst NumberInput: React.FC = ({ input, meta, ...rest }: Props) => (\n \n);\n\nexport default NumberInput;\n","import React from \"react\";\r\nimport Styles from \"../Styles\";\r\nimport { Form, Field } from \"react-final-form\";\r\nimport TextInput from \"../components/TextInput\";\r\nimport NumberInput from \"../components/NumberInput\";\r\nimport {connect} from \"react-redux\";\r\n\r\ninterface Values {\r\n firstName: string;\r\n ssn: string;\r\n initialAmount: number;\r\n}\r\n\r\nconst onSubmit = async (values: Values) => {\r\n const formData = new FormData();\r\n\r\n formData.append('firstName', values.firstName);\r\n formData.append('ssn', values.ssn);\r\n formData.append('initialAmount', values.initialAmount.toString());\r\n\r\n await fetch('api/v1/Customers', {\r\n method: 'POST',\r\n body: formData\r\n });\r\n};\r\n\r\nconst Register: React.FC = () => (\r\n \r\n

Register an Account

\r\n (\r\n
\r\n
\r\n \r\n \r\n name=\"firstName\"\r\n component={TextInput}\r\n placeholder=\"First Name\"\r\n />\r\n
\r\n
\r\n \r\n \r\n name=\"ssn\"\r\n component={TextInput}\r\n placeholder=\"SSN\"\r\n />\r\n
\r\n
\r\n \r\n \r\n name=\"initialAmount\"\r\n component={NumberInput}\r\n placeholder=\"Initial Amount\"\r\n />\r\n
\r\n
\r\n \r\n
\r\n
\r\n )}\r\n />\r\n
\r\n);\r\n\r\nexport default connect()(Register);\r\n","import React from \"react\";\r\nimport Styles from \"../Styles\";\r\nimport { Form, Field } from \"react-final-form\";\r\nimport NumberInput from \"../components/NumberInput\";\r\nimport {connect} from \"react-redux\";\r\nimport {RouteComponentProps} from \"react-router\";\r\n\r\ntype DepositProps = RouteComponentProps<{ accountId: string }>;\r\n\r\ninterface Values {\r\n amount: number;\r\n}\r\n\r\nclass Deposit extends React.PureComponent {\r\n\r\n private async onSubmit(values: Values) {\r\n const formData = new FormData();\r\n\r\n formData.append('accountId', this.props.match.params.accountId);\r\n formData.append('amount', values.amount.toString());\r\n\r\n await fetch('api/v1/Accounts/Deposit', {\r\n method: 'POST',\r\n body: formData\r\n });\r\n }\r\n\r\n public render() {\r\n return (\r\n \r\n

Deposit

\r\n (\r\n
\r\n
\r\n \r\n \r\n name=\"amount\"\r\n component={NumberInput}\r\n placeholder=\"amount\"\r\n />\r\n
\r\n
\r\n \r\n
\r\n
\r\n )}\r\n />\r\n
\r\n );\r\n }\r\n}\r\n\r\nexport default connect()(Deposit);\r\n","import React from \"react\";\r\nimport Styles from \"../Styles\";\r\nimport { Form, Field } from \"react-final-form\";\r\nimport NumberInput from \"../components/NumberInput\";\r\nimport {connect} from \"react-redux\";\r\nimport {RouteComponentProps} from \"react-router\";\r\n\r\ntype WithdrawProps = RouteComponentProps<{ accountId: string }>;\r\n\r\ninterface Values {\r\n amount: number;\r\n}\r\n\r\nclass Withdraw extends React.PureComponent {\r\n\r\n private async onSubmit(values: Values) {\r\n const formData = new FormData();\r\n\r\n formData.append('accountId', this.props.match.params.accountId);\r\n formData.append('amount', values.amount.toString());\r\n\r\n await fetch('api/v1/Accounts/Withdraw', {\r\n method: 'POST',\r\n body: formData\r\n });\r\n }\r\n\r\n public render() {\r\n return (\r\n \r\n

Withdraw

\r\n (\r\n
\r\n
\r\n \r\n \r\n name=\"amount\"\r\n component={NumberInput}\r\n placeholder=\"amount\"\r\n />\r\n
\r\n
\r\n \r\n
\r\n
\r\n )}\r\n />\r\n
\r\n );\r\n }\r\n}\r\n\r\nexport default connect()(Withdraw);\r\n","import * as React from 'react';\r\nimport { connect } from 'react-redux';\r\nimport { ApplicationState } from '../store';\r\nimport * as TransactionsStore from '../store/Transactions';\r\nimport { RouteComponentProps } from \"react-router\";\r\n\r\ntype TransactionsProps =\r\n TransactionsStore.TransactionsState\r\n & typeof TransactionsStore.actionCreators\r\n & RouteComponentProps<{ accountId: string }>;\r\n\r\n\r\nclass Transactions extends React.PureComponent {\r\n public componentDidMount() {\r\n this.ensureDataFetched();\r\n }\r\n\r\n public render() {\r\n console.log(this.props.account)\r\n\r\n return (\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {\r\n this.props.account.credits.map((transaction: TransactionsStore.Credit) =>\r\n \r\n \r\n \r\n \r\n \r\n \r\n )\r\n }\r\n \r\n
CreditAmountDescriptionTransaction Date
{transaction.transactionId}{transaction.amount}{transaction.description}{transaction.transactionDate}
\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {\r\n this.props.account.debits.map((transaction: TransactionsStore.Credit) =>\r\n \r\n \r\n \r\n \r\n \r\n \r\n )\r\n }\r\n \r\n
DebitAmountDescriptionTransaction Date
{transaction.transactionId}{transaction.amount}{transaction.description}{transaction.transactionDate}
\r\n
\r\n );\r\n }\r\n\r\n private ensureDataFetched() {\r\n this.props.requestTransactions(this.props.match.params.accountId);\r\n }\r\n}\r\n\r\nexport default connect(\r\n (state: ApplicationState) => state.accountDetails,\r\n TransactionsStore.actionCreators\r\n)(Transactions as any);\r\n","import * as React from 'react';\r\nimport { Route } from 'react-router';\r\nimport Layout from './components/Layout';\r\nimport Home from './components/Home';\r\nimport Accounts from './components/Accounts';\r\nimport Register from './components/Register';\r\nimport Deposit from './components/Deposit';\r\nimport Withdraw from \"./components/Withdraw\";\r\n\r\nimport './custom.css'\r\nimport Transactions from \"./components/Transactions\";\r\n\r\nexport default () => (\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n);\r\n","// In production, we register a service worker to serve assets from local cache.\r\n\r\n// This lets the app load faster on subsequent visits in production, and gives\r\n// it offline capabilities. However, it also means that developers (and users)\r\n// will only see deployed updates on the \"N+1\" visit to a page, since previously\r\n// cached resources are updated in the background.\r\n\r\n// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.\r\n// This link also includes instructions on opting out of this behavior.\r\n\r\nconst isLocalhost = Boolean(\r\n window.location.hostname === 'localhost' ||\r\n // [::1] is the IPv6 localhost address.\r\n window.location.hostname === '[::1]' ||\r\n // 127.0.0.1/8 is considered localhost for IPv4.\r\n window.location.hostname.match(\r\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\r\n )\r\n);\r\n\r\nexport default function register() {\r\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\r\n // The URL constructor is available in all browsers that support SW.\r\n const url = process.env.PUBLIC_URL as string;\r\n const publicUrl = new URL(url, window.location.toString());\r\n if (publicUrl.origin !== window.location.origin) {\r\n // Our service worker won't work if PUBLIC_URL is on a different origin\r\n // from what our page is served on. This might happen if a CDN is used to\r\n // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374\r\n return;\r\n }\r\n\r\n window.addEventListener('load', () => {\r\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\r\n\r\n if (isLocalhost) {\r\n // This is running on localhost. Lets check if a service worker still exists or not.\r\n checkValidServiceWorker(swUrl);\r\n } else {\r\n // Is not local host. Just register service worker\r\n registerValidSW(swUrl);\r\n }\r\n });\r\n }\r\n}\r\n\r\nfunction registerValidSW(swUrl: string) {\r\n navigator.serviceWorker\r\n .register(swUrl)\r\n .then(registration => {\r\n registration.onupdatefound = () => {\r\n const installingWorker = registration.installing as ServiceWorker;\r\n installingWorker.onstatechange = () => {\r\n if (installingWorker.state === 'installed') {\r\n if (navigator.serviceWorker.controller) {\r\n // At this point, the old content will have been purged and\r\n // the fresh content will have been added to the cache.\r\n // It's the perfect time to display a \"New content is\r\n // available; please refresh.\" message in your web app.\r\n console.log('New content is available; please refresh.');\r\n } else {\r\n // At this point, everything has been precached.\r\n // It's the perfect time to display a\r\n // \"Content is cached for offline use.\" message.\r\n console.log('Content is cached for offline use.');\r\n }\r\n }\r\n };\r\n };\r\n })\r\n .catch(error => {\r\n console.error('Error during service worker registration:', error);\r\n });\r\n}\r\n\r\nfunction checkValidServiceWorker(swUrl: string) {\r\n // Check if the service worker can be found. If it can't reload the page.\r\n fetch(swUrl)\r\n .then(response => {\r\n // Ensure service worker exists, and that we really are getting a JS file.\r\n const contentType = response.headers.get('content-type');\r\n if (response.status === 404 || (contentType && contentType.indexOf('javascript') === -1)) {\r\n // No service worker found. Probably a different app. Reload the page.\r\n navigator.serviceWorker.ready.then(registration => {\r\n registration.unregister().then(() => {\r\n window.location.reload();\r\n });\r\n });\r\n } else {\r\n // Service worker found. Proceed as normal.\r\n registerValidSW(swUrl);\r\n }\r\n })\r\n .catch(() => {\r\n console.log('No internet connection found. App is running in offline mode.');\r\n });\r\n}\r\n\r\nexport function unregister() {\r\n if ('serviceWorker' in navigator) {\r\n navigator.serviceWorker.ready.then(registration => {\r\n registration.unregister();\r\n });\r\n }\r\n}\r\n","import 'bootstrap/dist/css/bootstrap.css';\r\n\r\nimport * as React from 'react';\r\nimport * as ReactDOM from 'react-dom';\r\nimport { Provider } from 'react-redux';\r\nimport { ConnectedRouter } from 'connected-react-router';\r\nimport { createBrowserHistory } from 'history';\r\nimport configureStore from './store/configureStore';\r\nimport App from './App';\r\nimport registerServiceWorker from './registerServiceWorker';\r\n\r\n// Create browser history to use in the Redux store\r\nconst baseUrl = document.getElementsByTagName('base')[0].getAttribute('href') as string;\r\nconst history = createBrowserHistory({ basename: baseUrl });\r\n\r\n// Get the application-wide store instance, prepopulating with state from the server where available.\r\nconst store = configureStore(history);\r\n\r\nReactDOM.render(\r\n \r\n \r\n \r\n \r\n ,\r\n document.getElementById('root'));\r\n\r\nregisterServiceWorker();\r\n","import { applyMiddleware, combineReducers, compose, createStore } from 'redux';\r\nimport thunk from 'redux-thunk';\r\nimport { connectRouter, routerMiddleware } from 'connected-react-router';\r\nimport { History } from 'history';\r\nimport { ApplicationState, reducers } from './';\r\n\r\nexport default function configureStore(history: History, initialState?: ApplicationState) {\r\n const middleware = [\r\n thunk,\r\n routerMiddleware(history)\r\n ];\r\n\r\n const rootReducer = combineReducers({\r\n ...reducers,\r\n router: connectRouter(history)\r\n });\r\n\r\n const enhancers = [];\r\n const windowIfDefined = typeof window === 'undefined' ? null : window as any;\r\n if (windowIfDefined && windowIfDefined.__REDUX_DEVTOOLS_EXTENSION__) {\r\n enhancers.push(windowIfDefined.__REDUX_DEVTOOLS_EXTENSION__());\r\n }\r\n\r\n return createStore(\r\n rootReducer,\r\n initialState,\r\n compose(applyMiddleware(...middleware), ...enhancers)\r\n );\r\n}\r\n"],"sourceRoot":""}