Skip to content

Commit 4e4d135

Browse files
committed
fix: replaced 'let' declarations to 'const'
1 parent b5b96ab commit 4e4d135

File tree

6 files changed

+9
-11
lines changed

6 files changed

+9
-11
lines changed

src/components/app/app.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import AppHeader from '../app-header/app-header';
2727
const App: React.FC = () => {
2828
const dispatch = useAppDispatch();
2929

30-
let location = useLocation<ILocation>();
31-
let background = location.state && location.state.background;
30+
const location = useLocation<ILocation>();
31+
const background = location.state && location.state.background;
3232

3333
const {
3434
itemsSuccess,

src/components/order-detailed-view/order-detailed-view.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const OrderDetailedView: FC<IOrderDetailedView> = ({ order, isOrderModal=false }
7575
);
7676

7777
const renderIngredientIcons = useCallback((): Array<IIngredient> => {
78-
let itemsToRender: Array<IIngredient> = orderedMiddleItems;
78+
const itemsToRender: Array<IIngredient> = orderedMiddleItems;
7979
// adding bun in the first place
8080
itemsToRender.splice(0, 0, orderedBun);
8181

@@ -103,7 +103,7 @@ const OrderDetailedView: FC<IOrderDetailedView> = ({ order, isOrderModal=false }
103103
else return null
104104
}, {});
105105

106-
let renderedItems: Array<JSX.Element> = [];
106+
const renderedItems: Array<JSX.Element> = [];
107107
for (let item_id in uniqueCountedItems) {
108108
renderedItems.push(
109109
<li
@@ -140,7 +140,7 @@ const OrderDetailedView: FC<IOrderDetailedView> = ({ order, isOrderModal=false }
140140

141141
const calculateOrderPrice = useCallback((): number => {
142142
const orderIngredients: Array<IIngredient> = order.ingredients?.map(item_id => {
143-
let orderedItem: IIngredient = items.find(item => item._id === item_id) || {};
143+
const orderedItem: IIngredient = items.find(item => item._id === item_id) || {};
144144
return ({
145145
price: orderedItem.price,
146146
type: orderedItem.type

src/components/orders-card/orders-card.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const OrdersCard: FC<IOrdersCardProps> = ({ order, source }) => {
8383
item && item.type !== 'bun');
8484

8585
const renderIngredientIcons = useCallback(() => {
86-
let itemsToRender = orderedMiddleItems;
86+
const itemsToRender = orderedMiddleItems;
8787
// adding bun in the first place
8888
itemsToRender && itemsToRender.splice(0, 0, orderedBun);
8989

src/pages/ingredient-modal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const IngredientModalPage: FC = () => {
2424

2525
const { request } = itemsSlice.actions;
2626

27-
let history = useHistory();
27+
const history = useHistory();
2828

2929
const currentItemId: string = useParams<{ id: string }>().id;
3030
const currentItem: IIngredient = items.find((item) => item._id === currentItemId) || {};

src/pages/order-modal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const OrderModalPage: FC = () => {
3939

4040
const { request } = itemsSlice.actions;
4141

42-
let history = useHistory();
42+
const history = useHistory();
4343
const location = useLocation<ILocation>();
4444

4545
useEffect(() => {

src/services/utils.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ export function setCookie(
5959
value: string | number | boolean,
6060
props: ICookieProps = {}
6161
): void {
62-
// props: ICookieProps = props || {};
63-
// let expiration: sr = props.expires;
6462
if (typeof props.expires == 'number' && props.expires) {
6563
const d = new Date();
6664
d.setTime(d.getTime() + props.expires * 1000);
@@ -69,7 +67,7 @@ export function setCookie(
6967
if (props.expires instanceof Date && props.expires) {
7068
props.expires = props.expires.toUTCString();
7169
}
72-
let cookieValue: string = encodeURIComponent(value);
70+
const cookieValue: string = encodeURIComponent(value);
7371
let updatedCookie: string = name + '=' + cookieValue;
7472
let propName: keyof ICookieProps;
7573
for (propName in props) {

0 commit comments

Comments
 (0)