2024-07-06 11:05:19 +08:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
import { combineReducers } from "redux";
|
|
|
|
const initialState = {
|
|
|
|
authInfo: {
|
|
|
|
isSignin: false,
|
|
|
|
userToken: null,
|
2024-12-13 18:24:36 +08:00
|
|
|
recommendMid: null,
|
|
|
|
inviter: null,
|
2024-07-06 11:05:19 +08:00
|
|
|
},
|
2024-12-13 18:24:36 +08:00
|
|
|
noticeCount: 0,
|
2024-07-06 11:05:19 +08:00
|
|
|
};
|
|
|
|
let text = (data) => {
|
|
|
|
return data ? data.token : undefined;
|
|
|
|
};
|
|
|
|
const reducer = (state = initialState, action) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case "HANDLOGIN":
|
|
|
|
return { ...state, authInfo: action.data };
|
2024-08-02 22:12:54 +08:00
|
|
|
case "HANDLESAVERECOMMENMID":
|
|
|
|
return { ...state, recommendMid: action.data };
|
2024-12-13 18:24:36 +08:00
|
|
|
case "ChANGENOTICECOUNT":
|
|
|
|
return { ...state, noticeCount: action.data };
|
|
|
|
case "ChANGEINVITER":
|
2025-01-10 17:37:49 +08:00
|
|
|
// console.log("ChANGEINVITER-------", action.data);
|
2024-12-13 18:24:36 +08:00
|
|
|
return { ...state, inviter: action.data };
|
2024-07-06 11:05:19 +08:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
const reducers = combineReducers({
|
|
|
|
reducer,
|
|
|
|
});
|
|
|
|
|
|
|
|
export default reducers;
|