news scroll reducer

This commit is contained in:
VividTruthKeeper 2023-02-10 01:20:19 +05:00
parent 0fad55ef98
commit ad09a4a708
1 changed files with 59 additions and 12 deletions

View File

@ -1,14 +1,61 @@
// // Types
// import { ILanguage, ILanguageAction } from "../types/store.types";
// Types
import { INewsScroll, INewsScrollAction } from "../types/store.types";
// // Helpers
// import getSavedLanguage from "../helpers/getSavedLanguage";
export const postsInitialState = {
data: [
{
id: -1,
title: "",
slug: "",
excerpt: "",
published_at: "",
featured_images: [
{
id: -1,
disk_name: "",
file_name: "",
path: "",
extension: "",
},
{
id: -1,
disk_name: "",
file_name: "",
path: "",
extension: "",
},
{
id: -1,
disk_name: "",
file_name: "",
path: "",
extension: "",
},
],
content_html: "",
categories: [
{
id: -1,
name: "",
},
],
powerseo_title: "",
powerseo_description: "",
powerseo_keywords: "",
},
],
};
// const initialState = {
// title: getSavedLanguage(),
// };
// export const languageReducer = (
// state: ILanguage = initialState,
// action: ILanguageAction
// ) => {};
export const dataReducer = (
state: INewsScroll = postsInitialState,
action: INewsScrollAction
) => {
switch (action.type) {
case "SET_NEWS_SCROLL": {
return { ...state, data: action.payload };
}
default: {
return state;
}
}
};