feat(家庭健康): 优化家庭组加入流程,移除自动创建家庭组逻辑
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
* 家庭健康管理 Redux Slice
|
||||
*/
|
||||
|
||||
import { createAsyncThunk, createSlice, PayloadAction } from '@reduxjs/toolkit';
|
||||
import * as healthProfileApi from '@/services/healthProfile';
|
||||
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
||||
import { RootState } from './index';
|
||||
|
||||
// ==================== State 类型定义 ====================
|
||||
@@ -56,21 +56,6 @@ export const fetchFamilyGroup = createAsyncThunk(
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* 创建家庭组
|
||||
*/
|
||||
export const createFamilyGroup = createAsyncThunk(
|
||||
'familyHealth/createGroup',
|
||||
async (name: string, { rejectWithValue }) => {
|
||||
try {
|
||||
const data = await healthProfileApi.createFamilyGroup(name);
|
||||
return data;
|
||||
} catch (err: any) {
|
||||
return rejectWithValue(err?.message ?? '创建家庭组失败');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* 生成邀请码
|
||||
*/
|
||||
@@ -208,20 +193,6 @@ const familyHealthSlice = createSlice({
|
||||
state.error = action.payload as string;
|
||||
})
|
||||
|
||||
// 创建家庭组
|
||||
.addCase(createFamilyGroup.pending, (state) => {
|
||||
state.loading = true;
|
||||
state.error = null;
|
||||
})
|
||||
.addCase(createFamilyGroup.fulfilled, (state, action) => {
|
||||
state.loading = false;
|
||||
state.familyGroup = action.payload;
|
||||
})
|
||||
.addCase(createFamilyGroup.rejected, (state, action) => {
|
||||
state.loading = false;
|
||||
state.error = action.payload as string;
|
||||
})
|
||||
|
||||
// 生成邀请码
|
||||
.addCase(generateInviteCode.pending, (state) => {
|
||||
state.inviteLoading = true;
|
||||
|
||||
Reference in New Issue
Block a user