upd:banner home

deskripsi:
- load banner di halaman home

- nb : blm selesai

No Issues
This commit is contained in:
amel
2025-04-25 17:37:06 +08:00
parent 120a8cc92e
commit ba8984b7c5
5 changed files with 62 additions and 4 deletions

29
lib/bannerSlice.ts Normal file
View File

@@ -0,0 +1,29 @@
import { createSlice } from '@reduxjs/toolkit';
const bannerSlice = createSlice({
name: 'banner',
initialState: [],
reducers: {
setEntities: (state, action) => {
return action.payload;
},
addEntity: (state: any, action: any) => {
state.push(action.payload);
},
updateEntity: (state: any, action) => {
const { id, updatedEntity } = action.payload;
const index = state.findIndex((entity: any) => entity.id === id);
if (index !== -1) {
state[index] = updatedEntity;
}
},
// removeEntity: (state, action) => {
// const idToRemove = action.payload;
// return state.filter((entity: any) => entity.id !== idToRemove);
// },
},
});
export const { setEntities, addEntity, updateEntity } = bannerSlice.actions;
export default bannerSlice.reducer;