Spaces:
Paused
Paused
Download client/src/store/notificationSlice.js from arabdullah/chatty: direct link, hf CLI and curl.
- Browser
- Download file 591 Bytes
-
https://huggingface.co/spaces/arabdullah/chatty/resolve/main/client/src/store/notificationSlice.js
- Command line
-
hf download hf://spaces/arabdullah/chatty/client/src/store/notificationSlice.js
-
curl -L -o notificationSlice.js https://huggingface.co/spaces/arabdullah/chatty/resolve/main/client/src/store/notificationSlice.js
591 Bytes
| import { createSlice } from "@reduxjs/toolkit"; | |
| const initialState = []; | |
| const notificationSlice = createSlice({ | |
| name: "notification", | |
| initialState, | |
| reducers: { | |
| addNotification: (state, { payload }) => { | |
| const id = Date.now(); | |
| state.push({ | |
| ...payload, | |
| id, | |
| }); | |
| }, | |
| removeNotification: (state, { payload: id }) => { | |
| return state.filter((notif) => notif.id !== id); | |
| }, | |
| clearAllNotifications: () => initialState, | |
| }, | |
| }); | |
| export const notificationActions = notificationSlice.actions; | |
| export default notificationSlice.reducer; | |