diff --git a/.gitignore b/.gitignore index 8c89fe60..3ab8ef2c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ target/* /target npm-debug.log /bin/ +client/* \ No newline at end of file diff --git a/client/server.js b/client/server.js index bc5ea74d..5ec811a3 100644 --- a/client/server.js +++ b/client/server.js @@ -243,7 +243,6 @@ function runDevServer(port, protocol) { // clearConsole(); console.log(chalk.cyan('Starting the development server...')); console.log(); - // openBrowser(port, protocol); }); } diff --git a/client/src/components/owners/NewOwnerPage.tsx b/client/src/components/owners/NewOwnerPage.tsx index f6965eed..301a4047 100644 --- a/client/src/components/owners/NewOwnerPage.tsx +++ b/client/src/components/owners/NewOwnerPage.tsx @@ -14,68 +14,4 @@ const newOwner = (): IOwner => ({ pets: [] }); -export default () => ; - -// export default class NewOwnerPage extends React.Component { - -// context: IRouterContext; - -// static contextTypes = { -// router: React.PropTypes.object.isRequired -// }; - -// constructor() { -// super(); -// this.onInputChange = this.onInputChange.bind(this); -// this.onSubmit = this.onSubmit.bind(this); - -// this.state = { owner: newOwner() }; -// } - -// onSubmit(event) { -// event.preventDefault(); - -// const { owner } = this.state; - -// submitForm('/api/owner', owner, (status, response) => { -// if (status === 201) { -// const newOwner = response as IOwner; -// this.context.router.push({ -// pathname: '/owners/' + newOwner.id -// }); -// } else { -// console.log('ERROR?!...', response); -// this.setState({ error: response }); -// } -// }); -// } - -// onInputChange(name: string, value: string) { -// const { owner } = this.state; -// const modifiedOwner = Object.assign({}, owner, { [name]: value }); -// this.setState({ owner: modifiedOwner }); -// } - -// render() { -// const { owner, error } = this.state; -// return ( -// -//

New Owner

-//
-//
-// -// -// -// -// -//
-//
-//
-// -//
-//
-//
-//
-// ); -// } -// } \ No newline at end of file +export default () => ; \ No newline at end of file diff --git a/client/src/middleware/api.ts b/client/src/middleware/api.ts deleted file mode 100644 index 43cab2ea..00000000 --- a/client/src/middleware/api.ts +++ /dev/null @@ -1,73 +0,0 @@ -// // taken from by https://github.com/reactjs/redux/blob/master/examples/real-world/middleware/api.js - -// type IApiCallMethod = 'GET' | 'POST' | 'PATCH'; - -// export interface IApiCallData { -// endpoint: string; -// method?: IApiCallMethod; -// // fetching, onSuccess, onFailure -// types: string[]; -// body?: any; -// successMessage?: string; -// } - -// const CALL_API = 'CALL_API'; - -// export interface IApiAction { -// CALL_API: IApiCallData; -// } - -// function doApiCall(store, apiCallData: IApiCallData) { - -// const params: any = { -// headers: {} -// }; -// params.method = apiCallData.method || 'GET'; -// params.body = JSON.stringify(apiCallData.body); -// if (params.body) { -// params.headers['Accept'] = 'application/json'; -// params.headers['Content-Type'] = 'application/json'; -// } - - -// return fetch(`http://localhost:8080${apiCallData.endpoint}`, params) -// .then(response => -// response.json().then(json => ({ json, response })) -// ).then(({ json, response }) => { -// if (!response.ok) { -// return Promise.reject(json); -// } - -// return json; -// }); -// } - -// export default store => next => action => { -// function actionWith(data) { -// const finalAction = Object.assign({}, action, data); -// delete finalAction[CALL_API]; -// return finalAction; -// } - -// const callAPI: IApiCallData = action[CALL_API]; -// if (typeof callAPI === 'undefined') { -// // not an API call -// return next(action); -// } - - -// const { endpoint, types } = callAPI; - -// const [requestType, successType, failureType] = types; - -// // before sending the request: send action that request begins -// next(actionWith({ type: requestType })); - -// return doApiCall(store, callAPI).then( -// response => next(actionWith({payload: response, type: successType, success: callAPI.successMessage})), -// error => next(actionWith({ -// type: failureType, -// error: error.message || 'Something bad happened' -// })) -// ); -// }; diff --git a/client/tests/__tests__/fetch-mock.js b/client/tests/__tests__/fetch-mock.js index 2ee1f6a1..de3dfbf8 100644 --- a/client/tests/__tests__/fetch-mock.js +++ b/client/tests/__tests__/fetch-mock.js @@ -54,14 +54,6 @@ fetch.mockResponseOnce = (body, init) => { ); }; -// fetch.mockResponses = (...responses) => { -// responses.forEach(([body, init]) => { -// fetch.mockImplementationOnce( -// () => Promise.resolve(new ResponseWrapper(body, init)) -// ); -// }) -// }; - // Default mock is just a empty string. fetch.mockResponse('');