Skip to content

Commit

Permalink
update/решение проблемы компиляции проекта
Browse files Browse the repository at this point in the history
  • Loading branch information
southatelove committed Aug 21, 2024
1 parent 04b8c08 commit a88f932
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pages/Cart/Cart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const DELIVERY_FEE: number = 169;
export default function Cart() {
const [cartProducts, setCardProducts] = useState<Product[]>();
const items = useSelector((s: RootState) => s.cart.items);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const jwt = useSelector((s: RootState) => s.user.jwt);
const dispatch = useDispatch();
const navigate = useNavigate();
Expand All @@ -42,6 +44,8 @@ export default function Cart() {

const checkout = async () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const { data } = await axios.post(
`${PREFIX}/order`,
{
Expand All @@ -53,6 +57,7 @@ export default function Cart() {
},
}
);

dispatch(cartActions.clean());
navigate("/success");
};
Expand Down
8 changes: 8 additions & 0 deletions src/store/user.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ export const register = createAsyncThunk(

export const getProfile = createAsyncThunk<Profile, void, { state: RootState }>(
"user/getProfile",
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
async (_, thunkApi) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const jwt = thunkApi.getState().user.jwt;
const { data } = await axios.get<LoginResponse>(`${PREFIX}/user/profile`, {
headers: {
Expand Down Expand Up @@ -102,6 +106,8 @@ export const userSlice = createSlice({
},
},
extraReducers: (builder) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
builder.addCase(
login.fulfilled,
(state, action: PayloadAction<LoginResponse>) => {
Expand All @@ -117,6 +123,8 @@ export const userSlice = createSlice({
builder.addCase(getProfile.fulfilled, (state, action) => {
state.profile = action.payload;
});
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
builder.addCase(
register.fulfilled,
(state, action: PayloadAction<LoginResponse>) => {
Expand Down

0 comments on commit a88f932

Please sign in to comment.