refactor: rename contact with user

This commit is contained in:
Tristan Yang
2022-07-04 16:12:23 +08:00
parent 6083040e2b
commit 101dbdb5ee
76 changed files with 319 additions and 286 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ export interface State {
draftMixedText: { [key: string]: any };
remeberedNavs: {
chat: null | string;
contact: null | string;
user: null | string;
};
}
@@ -39,7 +39,7 @@ const initialState: State = {
// todo: typo
remeberedNavs: {
chat: null,
contact: null
user: null
}
};
@@ -19,18 +19,18 @@ const initialState: State = {
byId: {}
};
const contactsSlice = createSlice({
name: "contacts",
const usersSlice = createSlice({
name: "users",
initialState,
reducers: {
resetContacts() {
return initialState;
},
fullfillContacts(state, action: PayloadAction<StoredUser[]>) {
const contacts = action.payload || [];
state.ids = contacts.map(({ uid }) => uid);
const users = action.payload || [];
state.ids = users.map(({ uid }) => uid);
state.byId = Object.fromEntries(
contacts.map((c) => {
users.map((c) => {
const { uid } = c;
return [uid, c];
})
@@ -100,5 +100,5 @@ const contactsSlice = createSlice({
});
export const { resetContacts, fullfillContacts, updateUsersByLogs, updateUsersStatus } =
contactsSlice.actions;
export default contactsSlice.reducer;
usersSlice.actions;
export default usersSlice.reducer;