исправил клиент, пути в функциях, добавил переменную окружения
This commit is contained in:
1 parent
8aa8e04077
commit
1699873ea8
8 files changed
+59
-19
No files matched your search
@@ -1,11 +1,11 @@
|
||||
import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import type { Category } from "../../types/categories";
|
||||
import axios from "axios";
|
||||
import {client} from "../../api/client";
|
||||
|
||||
export const fetchCategories = createAsyncThunk<Category[]>(
|
||||
"categories/fetchCategories",
|
||||
async () => {
|
||||
const res = await axios.get<Category[]>("/api/categories");
|
||||
const res = await client.get<Category[]>("/categories");
|
||||
return res.data;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
|
||||
import type {PayloadAction} from "@reduxjs/toolkit";
|
||||
import client from "../../api/client";
|
||||
import {client} from "../../api/client";
|
||||
import type { Product } from "../../types/product";
|
||||
import axios from "axios";
|
||||
|
||||
@@ -42,7 +42,7 @@ export const fetchProductsByCategory = createAsyncThunk(
|
||||
export const fetchProductById = createAsyncThunk(
|
||||
"product/fetchById",
|
||||
async (id: string) => {
|
||||
const response = await axios.get(`/api/products/${id}`);
|
||||
const response = await client.get<Product>(`/products/${id}`);
|
||||
return response.data;
|
||||
}
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user