-
Notifications
You must be signed in to change notification settings - Fork 20
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
ДЗ7 #84
base: master
Are you sure you want to change the base?
ДЗ7 #84
Conversation
<Route path="/" component={() => '404 - not found'} /> | ||
<Route path="/error" component={ErrorPage} /> | ||
<Route path="/success" component={() => <h1>Thanks for order!</h1>} /> | ||
<Redirect from="/" to="/restaurants" /> |
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.
Redirect с рута лучше ставить самым первым, так мы сразу понимаем, что происходит при первом заходе на /
@@ -38,7 +39,11 @@ function BasketItem({ | |||
small | |||
/> | |||
</div> | |||
<p className={cn(styles.count, styles.price)}>{subtotal} $</p> | |||
<p className={cn(styles.count, styles.price)}> | |||
<CurrencyConsumer> |
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.
не самы удобный АПИ получается у фунции конвертации, покажу как удобнее на своей домашке
@@ -88,3 +103,13 @@ export const averageRatingSelector = createSelector( | |||
); | |||
} | |||
); | |||
|
|||
export const currentRouteSelector = createSelector( |
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.
тут можно использовать селектор из connected-react-router
dispatch(replace('/success')); | ||
} catch (error) { | ||
dispatch({ type: CHECKOUT + FAILURE, error: error?.message }); | ||
dispatch(replace('/error', { error: error?.message })); |
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.
это состояние лучше все таки хранить в redux
})), | ||
[] | ||
); | ||
const [selectedOption, setSelectedOption] = useState([options[0]]); |
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.
это лишнее состояние, можно взять currency из CurrencyContext
Успела сделать редирект на страницу ресторанов, отправку заказа и переключение валют, но без пересчёта значений по курсу (только валюты сами вывела).
Не успела доделать пересчёт валют и CSS-анимации.