Private Creators
diff --git a/src/store/slices/creatorsSlice.js b/src/store/slices/creatorsSlice.js
index 8d12cf4..02da087 100644
--- a/src/store/slices/creatorsSlice.js
+++ b/src/store/slices/creatorsSlice.js
@@ -222,7 +222,7 @@ export const fetchCreators = createAsyncThunk(
async ({ page = 1 }, { getState, rejectWithValue }) => {
try {
const state = getState();
- const filter = state.filters;
+ const {pricing, ...filter} = state.filters;
const { code, data, message, pagination } = await api.post(
`/daren_detail/public/creators/filter/?page=${page}`,
diff --git a/src/store/slices/discoverySlice.js b/src/store/slices/discoverySlice.js
index 4282b75..a2259d0 100644
--- a/src/store/slices/discoverySlice.js
+++ b/src/store/slices/discoverySlice.js
@@ -26,9 +26,9 @@ const mockCreators = [
];
export const fetchDiscovery = createAsyncThunk(
'discovery/fetchDiscovery',
- async (searchParams, { rejectWithValue }) => {
+ async (query, { rejectWithValue, dispatch }) => {
try {
- const response = await api.post('/creators/search/', searchParams);
+ const response = await api.post('/discovery/creators/search/', {query: query});
if (response.code === 200) {
return response.data;
}
@@ -42,7 +42,7 @@ export const fetchDiscovery = createAsyncThunk(
export const fetchDiscoveryByMode = createAsyncThunk(
'discovery/fetchDiscoveryByMode',
- async (params, { rejectWithValue }) => {
+ async (params, { rejectWithValue, dispatch }) => {
try {
const response = await api.post('/discovery/creators/search_tags/', params);
if (response.code === 200) {
@@ -56,6 +56,21 @@ export const fetchDiscoveryByMode = createAsyncThunk(
}
);
+export const fetchDiscoveryByIndividual = createAsyncThunk(
+ 'discovery/fetchDiscoveryByIndividual',
+ async (params, { rejectWithValue, dispatch }) => {
+ try {
+ const response = await api.post('/discovery/creators/search_individual/', params);
+ if (response.code === 200) {
+ return response.data;
+ }
+ throw new Error(response.message);
+ } catch (error) {
+ dispatch(setNotificationBarMessage({ message: error.message, type: 'error' }));
+ return rejectWithValue(error.message);
+ }
+ }
+);
const initialState = {
creators: [],
status: 'idle',
@@ -77,7 +92,7 @@ const discoverySlice = createSlice({
})
.addCase(fetchDiscovery.rejected, (state, action) => {
state.status = 'failed';
- state.error = action.error.message;
+ state.error = action.payload;
})
.addCase(fetchDiscoveryByMode.pending, (state) => {
state.status = 'loading';
@@ -88,7 +103,18 @@ const discoverySlice = createSlice({
})
.addCase(fetchDiscoveryByMode.rejected, (state, action) => {
state.status = 'failed';
- state.error = action.error.message;
+ state.error = action.payload;
+ })
+ .addCase(fetchDiscoveryByIndividual.pending, (state) => {
+ state.status = 'loading';
+ })
+ .addCase(fetchDiscoveryByIndividual.fulfilled, (state, action) => {
+ state.status = 'succeeded';
+ state.creators = action.payload;
+ })
+ .addCase(fetchDiscoveryByIndividual.rejected, (state, action) => {
+ state.status = 'failed';
+ state.error = action.payload;
});
},
});