Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

ДЗ7 #84

wants to merge 3 commits into from

Conversation

chrstnv
Copy link

@chrstnv chrstnv commented Dec 11, 2020

Успела сделать редирект на страницу ресторанов, отправку заказа и переключение валют, но без пересчёта значений по курсу (только валюты сами вывела).
Не успела доделать пересчёт валют и CSS-анимации.

<Route path="/" component={() => '404 - not found'} />
<Route path="/error" component={ErrorPage} />
<Route path="/success" component={() => <h1>Thanks for order!</h1>} />
<Redirect from="/" to="/restaurants" />
Copy link
Owner

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>
Copy link
Owner

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(
Copy link
Owner

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 }));
Copy link
Owner

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]]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это лишнее состояние, можно взять currency из CurrencyContext

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants