Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added documentation to src/redux/series/kids.reducer.js #69

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/redux/series/kids.reducer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
import { seriesActionTypes } from './series.types';

// This file defines a Redux reducer called `kidsSeriesReducer` that handles the state management
// for kids' series in the Fakeflix application.
//
// The reducer manages the following states:
// - `loading`: indicates whether data is currently being fetched.
// - `error`: stores error messages, if any occur during data fetching.
// - `data`: an array that holds the kids' series data.
//
// It responds to the following action types from `seriesActionTypes`:
// 1. `FETCH_KIDS_SERIES_REQUEST`: Sets `loading` to true when a request is initiated.
// 2. `FETCH_KIDS_SERIES_SUCCESS`: Updates the `data` with the fetched kids' series and stops loading.
// 3. `LOAD_MORE_KIDS_SERIES_SUCCESS`: Appends more kids' series to the existing data array.
// 4. `FETCH_KIDS_SERIES_FAILURE`: Clears the `data`, sets `loading` to false, and stores the error message.
//
// The reducer returns a new state based on the action dispatched or the initial state by default.

const initialState = {
loading: false,
error: '',
Expand Down
Loading