-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature(book detail): reimplement book detail logic #36
Conversation
@@ -6,6 +6,7 @@ import { Redirect } from 'react-router-dom'; | |||
|
|||
import Header from '../header/Header'; | |||
import { borrowBook, deleteBook } from '../../actions/library'; | |||
import { viewBookDetails } from '../../actions/viewBook'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module '../../actions/viewBook' import/no-unresolved
@@ -11,6 +12,9 @@ import Library from './library/Library'; | |||
import BookDetail from './library/BookDetail'; | |||
import Dashboard from './dashboard/Dashboard'; | |||
import Logout from './auth/Logout'; | |||
import ForgotPassword from './forgotPassword'; | |||
|
|||
import UpdateProfile from './dashboard/UpdateProfile'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module './dashboard/UpdateProfile' import/no-unresolved
@@ -11,6 +12,9 @@ import Library from './library/Library'; | |||
import BookDetail from './library/BookDetail'; | |||
import Dashboard from './dashboard/Dashboard'; | |||
import Logout from './auth/Logout'; | |||
import ForgotPassword from './forgotPassword'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module './forgotPassword' import/no-unresolved
@@ -3,6 +3,7 @@ import { BrowserRouter, Route, Switch } from 'react-router-dom'; | |||
|
|||
|
|||
import Home from './Home'; | |||
import History from './history/History'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to resolve path to module './history/History' import/no-unresolved
* @param {Integer} id book Id | ||
* @return {any} dispatches an action to the redux store | ||
*/ | ||
export const viewBookDetails = id => dispatch => ( | ||
axios.get(`${API}/books/${id}`) | ||
.then((response) => { | ||
dispatch(getBook(response.data.data)); | ||
}, (error) => { | ||
Materialize.toast(error.response.data.message, 2500, 'red darken-4'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Materialize' is not defined no-undef
####What does this PR do?
Changes the implementation of login for viewing book details on the client-side
Any background context you want to provide?
The previous implementation relied on setting the book id in the redux store, then reading it that value before sending the required api. The new implementation takes advantage of react-router's match prop and so fetches the book information based on the url parameter, making it more expressive.