diff --git a/src/@core/layouts/components/navbar/UserDropdown.js b/src/@core/layouts/components/navbar/UserDropdown.js index 193c1825..f2b73951 100644 --- a/src/@core/layouts/components/navbar/UserDropdown.js +++ b/src/@core/layouts/components/navbar/UserDropdown.js @@ -26,7 +26,7 @@ const UserDropdown = () => { const { isLogin, user } = useSelector(state => state.authState); const handelrLogout = async () => { - dispatch(Actions.userLogout.request()); + dispatch(Actions.setLogout.request()); }; // useEffect(() => { diff --git a/src/components/account/login/AccountLogin.js b/src/components/account/login/AccountLogin.js index d7205df5..5e48ebaa 100644 --- a/src/components/account/login/AccountLogin.js +++ b/src/components/account/login/AccountLogin.js @@ -68,7 +68,7 @@ export const AccountLogin = ({ props }) => { return; } - dispatch(Actions.userLogin.request(loginForm)); + dispatch(Actions.setLogin.request(loginForm)); }; // 로그인 실패 모달 diff --git a/src/containers/analysis/simulator/AnalysisSimulationContainer.js b/src/containers/analysis/simulator/AnalysisSimulationContainer.js index d2648f88..76263f5a 100644 --- a/src/containers/analysis/simulator/AnalysisSimulationContainer.js +++ b/src/containers/analysis/simulator/AnalysisSimulationContainer.js @@ -239,7 +239,7 @@ export const AnalysisSimulationContainer = props => { // 로그아웃 const handlerLogout = () => { - dispatch(AuthAction.userLogout.request()); + dispatch(AuthAction.setLogout.request()); }; // 비행 시물레이션 데이터 닫기 diff --git a/src/modules/_sample/reducers/index.ts b/src/modules/_sample/reducers/index.ts index 3b1a9e91..ea027738 100644 --- a/src/modules/_sample/reducers/index.ts +++ b/src/modules/_sample/reducers/index.ts @@ -1,14 +1,14 @@ import { createReducer } from 'typesafe-actions'; import produce from 'immer'; -import { SampleState, initSample } from '../models'; +import { ISampleState, initSample } from '../models'; import * as Actions from '../actions'; /** * Reducer 함수는 카멜케이스를 사용하여 작성한다. */ -export const sampleReducer = createReducer( +export const sampleReducer = createReducer( initSample ).handleAction(Actions.getDroneList.success, (state, action) => produce(state, draft => {}) diff --git a/src/modules/account/auth/actions/index.ts b/src/modules/account/auth/actions/index.ts index d1fe4799..86fbd449 100644 --- a/src/modules/account/auth/actions/index.ts +++ b/src/modules/account/auth/actions/index.ts @@ -12,9 +12,9 @@ import { } from '../models'; // 로그인 -const USER_LOGIN_REQUEST = 'auth/USER_LOGIN_REQUEST'; -const USER_LOGIN_SUCCESS = 'auth/USER_LOGIN_SUCCESS'; -const USER_LOGIN_FAILURE = 'auth/USER_LOGIN_FAILURE'; +const SET_LOGIN_REQUEST = 'auth/SET_LOGIN_REQUEST'; +const SET_LOGIN_SUCCESS = 'auth/SET_LOGIN_SUCCESS'; +const SET_LOGIN_FAILURE = 'auth/SET_LOGIN_FAILURE'; // 인증 확인 const CHECK_AUTHENCATION_REQUEST = 'auth/CHECK_AUTHENCATION_REQUEST'; @@ -22,9 +22,9 @@ const CHECK_AUTHENCATION_SUCCESS = 'auth/CHECK_AUTHENCATION_SUCCESS'; const CHECK_AUTHENCATION_FAILURE = 'auth/CHECK_AUTHENCATION_FAILURE'; // 로그아웃 -const USER_LOGOUT_REQUEST = 'auth/USER_LOGOUT_REQUEST'; -const USER_LOGOUT_SUCCESS = 'auth/USER_LOGOUT_SUCCESS'; -const USER_LOGOUT_FAILURE = 'auth/USER_LOGOUT_FAILURE'; +const SET_LOGOUT_REQUEST = 'auth/SET_LOGOUT_REQUEST'; +const SET_LOGOUT_SUCCESS = 'auth/SET_LOGOUT_SUCCESS'; +const SET_LOGOUT_FAILURE = 'auth/SET_LOGOUT_FAILURE'; // 마이페이지 조회 const GET_USER_PAGE_REQUEST = 'auth/GET_USER_PAGE_REQUEST'; @@ -51,10 +51,10 @@ const UPDATE_USERPW_REQUEST = 'auth/UPDATE_USERPW_REQUEST'; const UPDATE_USERPW_SUCCESS = 'auth/UPDATE_USERPW_SUCCESS'; const UPDATE_USERPW_FAILURE = 'auth/UPDATE_USERPW_FAILURE'; -export const userLogin = createAsyncAction( - USER_LOGIN_REQUEST, - USER_LOGIN_SUCCESS, - USER_LOGIN_FAILURE +export const setLogin = createAsyncAction( + SET_LOGIN_REQUEST, + SET_LOGIN_SUCCESS, + SET_LOGIN_FAILURE )(); export const check = createAsyncAction( @@ -63,17 +63,17 @@ export const check = createAsyncAction( CHECK_AUTHENCATION_FAILURE )(); -export const userLogout = createAsyncAction( - USER_LOGOUT_REQUEST, - USER_LOGOUT_SUCCESS, - USER_LOGOUT_FAILURE +export const setLogout = createAsyncAction( + SET_LOGOUT_REQUEST, + SET_LOGOUT_SUCCESS, + SET_LOGOUT_FAILURE )(); // 사용안함? export const refresh = createAsyncAction( - USER_LOGOUT_REQUEST, - USER_LOGOUT_SUCCESS, - USER_LOGOUT_FAILURE + SET_LOGOUT_REQUEST, + SET_LOGOUT_SUCCESS, + SET_LOGOUT_FAILURE )(); export const getUserPage = createAsyncAction( @@ -107,9 +107,9 @@ export const updateUserPw = createAsyncAction( )(); const actions = { - userLogin, + setLogin, check, - userLogout, + setLogout, refresh, updateUser, getUserPage, diff --git a/src/modules/account/auth/apis/index.ts b/src/modules/account/auth/apis/index.ts index 571c6403..6eae0a8d 100644 --- a/src/modules/account/auth/apis/index.ts +++ b/src/modules/account/auth/apis/index.ts @@ -3,11 +3,11 @@ import { UserAccount, TokenAccount, UpdatePwRq, UpdateData } from '../models'; export const authAPI = { // 로그인 - usersLogin: async (data: UserAccount) => { + setLogin: async (data: UserAccount) => { return await axios.post('api/acnt/jwt/login', data); }, // 로그아웃 - usersLogout: (id: number) => { + setLogout: (id: number) => { return axios.get(`api/acnt/jwt/logout/${id}`); }, // 토큰 재발급 diff --git a/src/modules/account/auth/reducers/index.ts b/src/modules/account/auth/reducers/index.ts index efae9697..1570360d 100644 --- a/src/modules/account/auth/reducers/index.ts +++ b/src/modules/account/auth/reducers/index.ts @@ -4,17 +4,17 @@ import produce from 'immer'; import { createReducer } from 'typesafe-actions'; // action +import * as Actions from '../actions'; // import { // AuthAction, // getUserPage, // check, -// userLogin, -// userLogout, +// setLogin, +// setLogout, // refresh, // deleteUser, // checkUserPw // } from '../actions'; -import * as Actions from '../actions'; import { UserPageState, @@ -27,19 +27,19 @@ import { export const authReducer = createReducer( initAuth ) - .handleAction(Actions.userLogin.success, (state, action) => + .handleAction(Actions.setLogin.success, (state, action) => produce(state, draft => { draft.isLogin = true; draft.user = action.payload; }) ) - .handleAction(Actions.userLogin.request, (state, action) => + .handleAction(Actions.setLogin.request, (state, action) => produce(state, draft => { draft.isLogin = false; draft.message = ''; }) ) - .handleAction(Actions.userLogin.failure, (state, action) => + .handleAction(Actions.setLogin.failure, (state, action) => produce(state, draft => { draft.isLogin = false; draft.message = action.payload; @@ -63,7 +63,7 @@ export const authReducer = createReducer( draft.user = action.payload; }) ) - .handleAction(Actions.userLogout.success, state => + .handleAction(Actions.setLogout.success, state => produce(state, draft => { draft.isLogin = false; draft.user = undefined; diff --git a/src/modules/account/auth/sagas/index.ts b/src/modules/account/auth/sagas/index.ts index 59f4de6b..9cc26605 100644 --- a/src/modules/account/auth/sagas/index.ts +++ b/src/modules/account/auth/sagas/index.ts @@ -16,10 +16,10 @@ import { } from '../service/cookie'; import * as MessageActions from '../../../comn/message/actions/comnMessageAction'; -function* userLoginSaga(action: ActionType) { +function* setLoginSaga(action: ActionType) { const param = action.payload; try { - const { data, errorCode } = yield call(authAPI.usersLogin, param); + const { data, errorCode } = yield call(authAPI.setLogin, param); if (errorCode == '-101') { throw '계정 정보를 찾을 수 없습니다. 다시 확인해 주세요.'; @@ -40,12 +40,12 @@ function* userLoginSaga(action: ActionType) { // } yield put( - Actions.userLogin.success({ + Actions.setLogin.success({ ...user.data }) ); } catch (error: any) { - yield put(Actions.userLogin.failure(error)); + yield put(Actions.setLogin.failure(error)); // message.error(error); } @@ -106,25 +106,25 @@ function* checkSaga() { } } -function* userLogoutSaga() { +function* setLogoutSaga() { const accessToken = cookieStorage.getCookie(COOKIE_ACCESS_TOKEN); try { if (accessToken) { const decodedToken = decode(accessToken); - const res = yield call(authAPI.usersLogout, decodedToken.cstmrSno); + const res = yield call(authAPI.setLogout, decodedToken.cstmrSno); if (res.data == 'SUCCESS') { location.href = '/account/login'; } } - // yield put(Actions.userLogout.success()); + // yield put(Actions.setLogout.success()); cookieStorage.removeCookie(COOKIE_ACCESS_TOKEN); cookieStorage.removeCookie(COOKIE_REFRESH_TOKEN); yield put(replace('/')); } catch (error: any) { - yield put(Actions.userLogout.failure(error)); + yield put(Actions.setLogout.failure(error)); } } @@ -166,9 +166,9 @@ function* deleteUserSaga( // yield put(Actions.deleteUser.success(data));; } - // yield put(Actions.userLogout.success()); + // yield put(Actions.setLogout.success()); } catch (error: any) { - yield put(Actions.userLogout.failure(error)); + yield put(Actions.setLogout.failure(error)); } } @@ -291,8 +291,8 @@ function* updateUserPwSaga( } export function* authSaga() { - yield takeEvery(Actions.userLogin.request, userLoginSaga); - yield takeEvery(Actions.userLogout.request, userLogoutSaga); + yield takeEvery(Actions.setLogin.request, setLoginSaga); + yield takeEvery(Actions.setLogout.request, setLogoutSaga); yield takeEvery(Actions.check.request, checkSaga); yield takeEvery(Actions.getUserPage.request, getUserPageSaga); yield takeEvery(Actions.updateUser.request, updateUserSaga); diff --git a/src/modules/utils/customAxiosUtil.ts b/src/modules/utils/customAxiosUtil.ts index b4316bbd..aa34e018 100644 --- a/src/modules/utils/customAxiosUtil.ts +++ b/src/modules/utils/customAxiosUtil.ts @@ -51,7 +51,7 @@ clientInstance.interceptors.response.use( // refreshToken: getRefreshToken() // }) // ); - //store.dispatch(Actions.userLogout.request()); + //store.dispatch(Actions.setLogout.request()); // } else { // } diff --git a/src/views/control/main/ControlMain.js b/src/views/control/main/ControlMain.js index a5c7eed3..65e77db3 100644 --- a/src/views/control/main/ControlMain.js +++ b/src/views/control/main/ControlMain.js @@ -131,7 +131,7 @@ const ControlMain = () => { // 로그아웃 const handlerLogout = () => { - dispatch(Actions.userLogout.request()); + dispatch(Actions.setLogout.request()); }; // 드론 상세정보 창 닫기