diff --git a/src/containers/account/mypage/AccountMypageContainer.js b/src/containers/account/mypage/AccountMypageContainer.js index e484fca..ef42862 100644 --- a/src/containers/account/mypage/AccountMypageContainer.js +++ b/src/containers/account/mypage/AccountMypageContainer.js @@ -32,7 +32,8 @@ import AccountMypagePwForm from '../../../components/account/mypage/AccountMypag import AccountMypageForm from '../../../components/account/mypage/AccountMypageForm'; import { userPageAction, - userupdateAction + userupdateAction, + userDeleteAction } from '../../../modules/account/login/actions/authAction'; import { MessageErrorModal } from '../../../components/message/MessageErrorModal'; @@ -305,7 +306,6 @@ const AccountMypageContainer = () => { updateUserId: userInfo.userId, hpno: okcheck }; - dispatch(userupdateAction.request(param)); }; @@ -315,10 +315,11 @@ const AccountMypageContainer = () => { title: '탈퇴 확인', desc: '정말로 탈퇴 하시겠습니까?' }); - return; + }; const waitwait = () => { + dispatch(userDeleteAction.request(user.cstmrSno)); // alert('아직 탈퇴 못해용~'); setModal({ isOpen: true, diff --git a/src/modules/account/login/actions/authAction.ts b/src/modules/account/login/actions/authAction.ts index e6c9a9e..7e3ae40 100644 --- a/src/modules/account/login/actions/authAction.ts +++ b/src/modules/account/login/actions/authAction.ts @@ -27,6 +27,10 @@ const USERS_UPDATE_FAILURE = 'auth/USERS_UPDATE_FAILURE'; const USERS_PWUPDATE_REQUEST = 'auth/USERS_PWUPDATE_REQUEST'; const USERS_PWUPDATE_SUCCESS = 'auth/USERS_PWUPDATE_SUCCESS'; const USERS_PWUPDATE_FAILURE = 'auth/USERS_PWUPDATE_FAILURE'; +//mypage delete +const USERS_DELETE_REQUEST = 'auth/USERS_DELETE_REQUEST'; +const USERS_DELETE_SUCCESS = 'auth/USERS_DELETE_SUCCESS'; +const USERS_DELETE_FAILURE = 'auth/USERS_DELETE_FAILURE'; export const login = createAsyncAction( USERS_LOGIN_REQUEST, @@ -64,6 +68,12 @@ export const userPageAction = createAsyncAction( USERS_USERPAGE_FAILURE )(); +export const userDeleteAction = createAsyncAction( + USERS_DELETE_REQUEST, + USERS_DELETE_SUCCESS, + USERS_DELETE_FAILURE +)(); + export const pwUpdateAction = createAsyncAction( USERS_PWUPDATE_REQUEST, USERS_PWUPDATE_SUCCESS, @@ -76,7 +86,8 @@ const actions = { logout, refresh, userPageAction, - pwUpdateAction + pwUpdateAction, + userDeleteAction }; export type AuthAction = ActionType; diff --git a/src/modules/account/login/apis/authApi.ts b/src/modules/account/login/apis/authApi.ts index d56e621..5d46d24 100644 --- a/src/modules/account/login/apis/authApi.ts +++ b/src/modules/account/login/apis/authApi.ts @@ -29,4 +29,7 @@ export const authAPI = { pwupdate: async (data: UserPw) => { return await axios.post('api/acnt/cstmr/profile/pswdupdate', data); }, + deletedata: async(id: string) => { + return await axios.post(`api/acnt/cstmr/profile/delete/${id}`); + }, } diff --git a/src/modules/account/login/sagas/authSaga.ts b/src/modules/account/login/sagas/authSaga.ts index cbed4fb..88dd1b0 100644 --- a/src/modules/account/login/sagas/authSaga.ts +++ b/src/modules/account/login/sagas/authSaga.ts @@ -150,7 +150,19 @@ function* userPageSaga( yield put(Actions.userPageAction.failure(error)); } } +function* userDeletePageSaga( + action: ActionType +) { + try { + const controlId = action.payload; + const { data } = yield call(authAPI.deletedata, controlId); + // console.log('userPageData : ', data) + yield put(Actions.userDeleteAction.success(data)); + } catch (error) { + yield put(Actions.userDeleteAction.failure(error)); + } +} function* userUpdateSaga( action: ActionType ) { @@ -277,4 +289,5 @@ export function* authSaga() { yield takeEvery(Actions.userPageAction.request, userPageSaga); yield takeEvery(Actions.pwUpdateAction.request, userPwSaga); yield takeEvery(Actions.userupdateAction.request, userUpdateSaga); + yield takeEvery(Actions.userDeleteAction.request, userDeletePageSaga); } diff --git a/src/modules/account/register/apis/accountApi.ts b/src/modules/account/register/apis/accountApi.ts index d2014dd..aaaab1c 100644 --- a/src/modules/account/register/apis/accountApi.ts +++ b/src/modules/account/register/apis/accountApi.ts @@ -33,6 +33,7 @@ export const accountApi = { `api/acnt/crtfyhp/register/confirm?hpno=${hpno}&crtfyNo=${crtfyNo}` ); } + // list: async (data: string) => { // const queryString = qs.stringify(data, {