-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into enhancement_310_fix_routing_to_form_return…
…_page
- Loading branch information
Showing
36 changed files
with
328 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,4 @@ | |
font-size: 16px; | ||
font-weight: 400; | ||
color: var.$body-color; | ||
margin: 0; | ||
padding: 30px 0 56px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { StateSchema } from '@/app/providers/StoreProvider' | ||
|
||
export const putIncreaseProductAmountSelector = (state: StateSchema) => { | ||
return state.productAmount.isIncreaseSuccessful | ||
} | ||
|
||
export const getProductListSelector = (state: StateSchema) => { | ||
return state.productAmount.productList | ||
} |
25 changes: 25 additions & 0 deletions
25
src/features/CartEdit/model/services/putIncreaseProductAmount.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { createAsyncThunk } from '@reduxjs/toolkit' | ||
|
||
import { ThunkConfig } from '@/app/providers/StoreProvider/config/StateSchema' | ||
import { IProductCartList } from '@/models/ProductCartListModel' | ||
import { apiErrorIdentify } from '@/shared/api/apiErrorIdentify' | ||
import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' | ||
|
||
export const putIncreaseProductAmount = createAsyncThunk<IProductCartList, number, ThunkConfig<ApiError>>( | ||
'cart-increase-product-amount', | ||
async (productId, thunkAPI) => { | ||
const { rejectWithValue, extra } = thunkAPI | ||
try { | ||
const { data } = await extra.api.put( | ||
`api/${ApiRoutes.INCREASE_PRODUCT_AMOUNT}`, | ||
{ product: productId }, | ||
{ | ||
withCredentials: true | ||
} | ||
) | ||
return data | ||
} catch (error) { | ||
return rejectWithValue(apiErrorIdentify(error, ApiErrorTypes.DATA_EMPTY_ERROR)) | ||
} | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { createSlice } from '@reduxjs/toolkit' | ||
|
||
import { rejectedPayloadHandle } from '@/shared/api/rejectedPayloadHandle' | ||
|
||
import { putIncreaseProductAmount } from '../services/putIncreaseProductAmount' | ||
import { IProductAmountStateSchema } from '../types' | ||
|
||
const initialState: IProductAmountStateSchema = { | ||
isIncreaseSuccessful: false, | ||
productList: { | ||
amount: 0, | ||
product: { | ||
id: 0, | ||
category: 'string', | ||
brand: 'string', | ||
images: [], | ||
price: '', | ||
name: '', | ||
slug: '', | ||
description: '', | ||
code: 2147483647, | ||
wb_urls: '' | ||
}, | ||
full_price: 0 | ||
} | ||
} | ||
|
||
export const productAmountSlice = createSlice({ | ||
name: 'cart/product/amount', | ||
initialState, | ||
reducers: { | ||
setProductList: (state, { payload }) => { | ||
state.productList = payload | ||
} | ||
}, | ||
extraReducers: builder => { | ||
builder | ||
.addCase(putIncreaseProductAmount.pending, state => { | ||
state.isIncreaseSuccessful = false | ||
}) | ||
.addCase(putIncreaseProductAmount.fulfilled, (state, { payload }) => { | ||
state.isIncreaseSuccessful = true | ||
state.productList = payload | ||
}) | ||
.addCase(putIncreaseProductAmount.rejected, (state, { payload }) => { | ||
state.isIncreaseSuccessful = false | ||
state.error = rejectedPayloadHandle(payload) | ||
}) | ||
} | ||
}) | ||
|
||
export const { actions: productAmountActions, reducer: productAmountReducer } = productAmountSlice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { IProductCartList } from '@/models/ProductCartListModel' | ||
|
||
export interface IProductAmountStateSchema { | ||
isIncreaseSuccessful: boolean | ||
productList: IProductCartList | ||
error?: string | string[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { IProductCartList } from './ProductCartListModel' | ||
|
||
export interface ICart { | ||
id: number | ||
products: IProductCartList[] | ||
user: number | ||
cart_full_price: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface IImage { | ||
image: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { IProduct } from './ProductModel' | ||
|
||
export interface IProductCartList { | ||
amount: number | ||
product: IProduct | ||
full_price: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { IImage } from './ImageModel' | ||
|
||
export interface IProduct { | ||
id: number | ||
category: string | ||
brand: string | ||
images: IImage[] | ||
price: string | ||
name: string | ||
slug: string | ||
description: string | ||
code: number | ||
wb_urls: string | ||
quantity?: number | ||
is_deleted?: boolean | ||
wholesale?: number | ||
label_hit?: boolean | ||
label_popular?: boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
@use '@/shared/styles/utils/variables' as var; | ||
|
||
.title { | ||
.aboutUs { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 30px; | ||
width: 100%; | ||
margin: 0 0 10px; | ||
padding: 0; | ||
} | ||
|
||
.link { | ||
text-decoration: none; | ||
color: var.$subtitle-color; | ||
font-size: 13.5px; | ||
font-weight: 400; | ||
line-height: 16.2px; | ||
padding: 0 0 56px; | ||
|
||
&:hover { | ||
color: var.$theme-primary-color; | ||
&__titleBox { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 10px; | ||
} | ||
} |
Oops, something went wrong.