This commit is contained in:
QkoSad
2023-08-08 16:02:54 +03:00
commit 0a7a469d56
315 changed files with 426907 additions and 0 deletions
@@ -0,0 +1,23 @@
import { createSlice } from "@reduxjs/toolkit";
const notificationSlice = createSlice({
name: "notification",
initialState: [],
reducers: {
make(state, action, time) {
state.push(action.payload);
},
remove(state, action) {
state.pop();
},
},
});
const { make, remove} = notificationSlice.actions;
export const setNotification = (message,time) => {
return (dispatch) => {
dispatch(make(message));
setTimeout(() => dispatch(remove()), time * 1000);
};
};
export default notificationSlice.reducer;