Skip to content

Commit

Permalink
chore: fix Spelling Error
Browse files Browse the repository at this point in the history
  • Loading branch information
liyunfu1998 committed Apr 2, 2024
1 parent e2190a5 commit ca3262f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions components/cart/AddToCartOperation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useState, useEffect } from 'react'

import { addToCart, showAlert } from 'store'

import { exsitItem } from 'utils'
import { existItem } from 'utils'

import { ArrowLink, ProductPrice, CartButtons } from 'components'

Expand All @@ -25,7 +25,7 @@ const AddToCartOperation = props => {

//? Re-Renders
useEffect(() => {
const item = exsitItem(cartItems, product._id, tempColor, tempSize)
const item = existItem(cartItems, product._id, tempColor, tempSize)
setCurrentItemInCart(item)
}, [tempColor, tempSize, cartItems])

Expand Down
4 changes: 2 additions & 2 deletions store/slices/cart.slice.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PayloadAction, createSlice, nanoid } from '@reduxjs/toolkit'

import { exsitItem, getTotal } from 'utils'
import { existItem, getTotal } from 'utils'

const getCartItems = () => {
if (typeof window !== 'undefined') {
Expand Down Expand Up @@ -28,7 +28,7 @@ const cartSlice = createSlice({
addToCart: (state, action) => {
const { color, size, productID } = action.payload

let isItemExist = exsitItem(state.cartItems, productID, color, size)
let isItemExist = existItem(state.cartItems, productID, color, size)

if (isItemExist) {
isItemExist.quantity += 1
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion utils/exsitItem.js → utils/existItem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function exsitItem(cartItems, productID, color, size) {
export default function existItem(cartItems, productID, color, size) {
let result
if (color) {
result = cartItems.find(item => item.productID === productID && item.color?.id === color?.id)
Expand Down
4 changes: 2 additions & 2 deletions utils/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export * from './constatns'
export * from './constants'
export * from './validation'
export * from './exchange'
export { default as formatNumber } from './formatNumber'
export { default as truncate } from './truncate'
export { default as exsitItem } from './exsitItem'
export { default as existItem } from './existItem'
export { default as getTotal } from './getTotal'
4 changes: 2 additions & 2 deletions utils/localstorage.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class LocalStorage {
constructor() {}
constructor() { }

static setItem(key, value) {
if (typeof window !== 'undefined') {
localStorage.setItem(key, value)
localStorage.setItem(key, JSON.stringify(value))
}
}

Expand Down

0 comments on commit ca3262f

Please sign in to comment.