text: import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
  import { client } from "../utils";
  
  export const getCollectedVideos = createAsyncThunk(
    "collectedVideo/getCollectedVideos",
    async () => {
      const { data } = await client(
        `${process.env.REACT_APP_BE}/users/collectedVideos`
      );
      return data;
    }
  );
  
  const collectedVideoSlice = createSlice({
    name: "collectedVideo",
    initialState: {
      isFetching: true,
      videos: [],
    },
    extraReducers: {
      [getCollectedVideos.fulfilled]: (state, action) => {
        state.isFetching = false;
        state.videos = action.payload;
      },
    },
  });
  
  export const { addToCollectedVideos, removeFromCollectedVideos } =
    collectedVideoSlice.actions;
  
  export default collectedVideoSlice.reducer;
  