email redux push
This commit is contained in:
parent
c957362c7a
commit
695acac19d
|
@ -1,3 +1,45 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 4.
|
||||
*/
|
||||
import Action from '@overflow/commons/redux/Action';
|
||||
import EmailAuth from '@overflow/email/api/model/EmailAuth';
|
||||
|
||||
import ModifyPayload from '../payload/ModifyPayload';
|
||||
|
||||
// Action Type
|
||||
export type REQUEST = '@overflow/email/modify/REQUEST';
|
||||
export type REQUEST_SUCCESS = '@overflow/email/modify/REQUEST_SUCCESS';
|
||||
export type REQUEST_FAILURE = '@overflow/email/modify/REQUEST_FAILURE';
|
||||
|
||||
export const REQUEST: REQUEST = '@overflow/email/modify/REQUEST';
|
||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/email/modify/REQUEST_SUCCESS';
|
||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/email/modify/REQUEST_FAILURE';
|
||||
|
||||
// Action Creater
|
||||
export type request = (emailAuth:EmailAuth) => Action<ModifyPayload>;
|
||||
export type requestSuccess = (emailAuth: EmailAuth) => Action<EmailAuth>;
|
||||
export type requestFailure = (error: Error) => Action;
|
||||
|
||||
export const request: request = (emailAuth:EmailAuth): Action<ModifyPayload> => {
|
||||
return {
|
||||
type: REQUEST,
|
||||
payload: {
|
||||
emailAuth: emailAuth,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const requestSuccess: requestSuccess = (emailAuth: EmailAuth): Action<EmailAuth> => {
|
||||
return {
|
||||
type: REQUEST_SUCCESS,
|
||||
payload: emailAuth,
|
||||
};
|
||||
};
|
||||
|
||||
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||
return {
|
||||
type: REQUEST_FAILURE,
|
||||
error: error,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 4.
|
||||
*/
|
||||
import Action from '@overflow/commons/redux/Action';
|
||||
import EmailAuth from '@overflow/email/api/model/EmailAuth';
|
||||
|
||||
import ReadPayload from '../payload/ReadPayload';
|
||||
|
||||
// Action Type
|
||||
export type REQUEST = '@overflow/email/read/REQUEST';
|
||||
export type REQUEST_SUCCESS = '@overflow/email/read/REQUEST_SUCCESS';
|
||||
export type REQUEST_FAILURE = '@overflow/email/read/REQUEST_FAILURE';
|
||||
|
||||
export const REQUEST: REQUEST = '@overflow/email/read/REQUEST';
|
||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/email/read/REQUEST_SUCCESS';
|
||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/email/read/REQUEST_FAILURE';
|
||||
|
||||
// Action Creater
|
||||
export type request = (id: number) => Action<ReadPayload>;
|
||||
export type requestSuccess = (emailAuth: EmailAuth) => Action<EmailAuth>;
|
||||
export type requestFailure = (error: Error) => Action;
|
||||
|
||||
export const request: request = (id: number): Action<ReadPayload> => {
|
||||
return {
|
||||
type: REQUEST,
|
||||
payload: {
|
||||
id: id,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const requestSuccess: requestSuccess = (emailAuth: EmailAuth): Action<EmailAuth> => {
|
||||
return {
|
||||
type: REQUEST_SUCCESS,
|
||||
payload: emailAuth,
|
||||
};
|
||||
};
|
||||
|
||||
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||
return {
|
||||
type: REQUEST_FAILURE,
|
||||
error: error,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +1,41 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 4.
|
||||
*/
|
||||
import Action from '@overflow/commons/redux/Action';
|
||||
import EmailAuth from '@overflow/email/api/model/EmailAuth';
|
||||
|
||||
import ReadByAuthKeyPayload from '../payload/ReadByAuthKeyPayload';
|
||||
|
||||
// Action Type
|
||||
export type REQUEST = '@overflow/email/read_by_auth_key/REQUEST';
|
||||
export type REQUEST_SUCCESS = '@overflow/email/read_by_auth_key/REQUEST_SUCCESS';
|
||||
export type REQUEST_FAILURE = '@overflow/email/read_by_auth_key/REQUEST_FAILURE';
|
||||
|
||||
export const REQUEST: REQUEST = '@overflow/email/read_by_auth_key/REQUEST';
|
||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/email/read_by_auth_key/REQUEST_SUCCESS';
|
||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/email/read_by_auth_key/REQUEST_FAILURE';
|
||||
|
||||
// Action Creater
|
||||
export type request = (authKey: string) => Action<ReadByAuthKeyPayload>;
|
||||
export type requestSuccess = (emailAuth: EmailAuth) => Action<EmailAuth>;
|
||||
export type requestFailure = (error: Error) => Action;
|
||||
|
||||
export const request: request = (authKey: string): Action<ReadByAuthKeyPayload> => {
|
||||
return {
|
||||
type: REQUEST,
|
||||
payload: {
|
||||
authKey: authKey,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const requestSuccess: requestSuccess = (emailAuth: EmailAuth): Action<EmailAuth> => {
|
||||
return {
|
||||
type: REQUEST_SUCCESS,
|
||||
payload: emailAuth,
|
||||
};
|
||||
};
|
||||
|
||||
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||
return {
|
||||
type: REQUEST_FAILURE,
|
||||
error: error,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,3 +1,41 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 4.
|
||||
*/
|
||||
import Action from '@overflow/commons/redux/Action';
|
||||
import EmailAuth from '@overflow/email/api/model/EmailAuth';
|
||||
|
||||
import ReadByMemberPayload from '../payload/ReadByMemberPayload';
|
||||
|
||||
// Action Type
|
||||
export type REQUEST = '@overflow/email/read_by_member/REQUEST';
|
||||
export type REQUEST_SUCCESS = '@overflow/email/read_by_member/REQUEST_SUCCESS';
|
||||
export type REQUEST_FAILURE = '@overflow/email/read_by_member/REQUEST_FAILURE';
|
||||
|
||||
export const REQUEST: REQUEST = '@overflow/email/read_by_member/REQUEST';
|
||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/email/read_by_member/REQUEST_SUCCESS';
|
||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/email/read_by_member/REQUEST_FAILURE';
|
||||
|
||||
// Action Creater
|
||||
export type request = (memberId: number) => Action<ReadByMemberPayload>;
|
||||
export type requestSuccess = (emailAuths: EmailAuth[]) => Action<EmailAuth[]>;
|
||||
export type requestFailure = (error: Error) => Action;
|
||||
|
||||
export const request: request = (memberId: number): Action<ReadByMemberPayload> => {
|
||||
return {
|
||||
type: REQUEST,
|
||||
payload: {
|
||||
memberId: memberId,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const requestSuccess: requestSuccess = (emailAuths: EmailAuth[]): Action<EmailAuth[]> => {
|
||||
return {
|
||||
type: REQUEST_SUCCESS,
|
||||
payload: emailAuths,
|
||||
};
|
||||
};
|
||||
|
||||
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||
return {
|
||||
type: REQUEST_FAILURE,
|
||||
error: error,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
import Action from '@overflow/commons/redux/Action';
|
||||
import EmailAuth from '@overflow/email/api/model/EmailAuth';
|
||||
|
||||
import SendEmailPayload from '../payload/SendEmailByMemberPayload';
|
||||
|
||||
// Action Type
|
||||
export type REQUEST = '@overflow/email/send_email_by_member/REQUEST';
|
||||
export type REQUEST_SUCCESS = '@overflow/email/send_email_by_member/REQUEST_SUCCESS';
|
||||
export type REQUEST_FAILURE = '@overflow/email/send_email_by_member/REQUEST_FAILURE';
|
||||
|
||||
export const REQUEST: REQUEST = '@overflow/email/send_email_by_member/REQUEST';
|
||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/email/send_email_by_member/REQUEST_SUCCESS';
|
||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/email/send_email_by_member/REQUEST_FAILURE';
|
||||
|
||||
// Action Creater
|
||||
export type request = (memberId: number, email: string) => Action<SendEmailPayload>;
|
||||
export type requestSuccess = (emailAuth: EmailAuth) => Action<EmailAuth>;
|
||||
export type requestFailure = (error: Error) => Action;
|
||||
|
||||
export const request: request = (memberId: number, email: string): Action<SendEmailPayload> => {
|
||||
return {
|
||||
type: REQUEST,
|
||||
payload: {
|
||||
memberId: memberId,
|
||||
email: email,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const requestSuccess: requestSuccess = (emailAuth: EmailAuth): Action<EmailAuth> => {
|
||||
return {
|
||||
type: REQUEST_SUCCESS,
|
||||
payload: emailAuth,
|
||||
};
|
||||
};
|
||||
|
||||
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||
return {
|
||||
type: REQUEST_FAILURE,
|
||||
error: error,
|
||||
};
|
||||
};
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 4.
|
||||
*/
|
||||
import EmailAuth from '../../api/model/EmailAuth';
|
||||
|
||||
interface ModifyPayload {
|
||||
emailAuth: EmailAuth;
|
||||
}
|
||||
|
||||
export default ModifyPayload;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 4.
|
||||
*/
|
||||
interface ReadByAuthKeyPayload {
|
||||
authKey: string;
|
||||
}
|
||||
|
||||
export default ReadByAuthKeyPayload;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 4.
|
||||
*/
|
||||
interface ReadByMemberPayload {
|
||||
memberId: number;
|
||||
}
|
||||
|
||||
export default ReadByMemberPayload;
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 4.
|
||||
*/
|
||||
|
||||
interface ReadPayload {
|
||||
id: number;
|
||||
}
|
||||
|
||||
export default ReadPayload;
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
interface SendEmailByMemberPayload {
|
||||
memberId: number;
|
||||
email: string;
|
||||
}
|
||||
|
||||
export default SendEmailByMemberPayload;
|
|
@ -1,3 +1,44 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 4.
|
||||
*/
|
||||
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||
|
||||
|
||||
import AppContext from '@overflow/commons/context';
|
||||
import Action from '@overflow/commons/redux/Action';
|
||||
|
||||
import EmailAuth from '@overflow/email/api/model/EmailAuth';
|
||||
|
||||
import EmailAuthService from '@overflow/email/api/service/EmailAuthService';
|
||||
import * as ModifyAction from '../action/modify';
|
||||
import ModifyPayload from '../payload/ModifyPayload';
|
||||
|
||||
function* modify(action: Action<ModifyPayload>): SagaIterator {
|
||||
try {
|
||||
const ea = action.payload.emailAuth;
|
||||
// yield put({
|
||||
// type: types.SENDING_REQUEST,
|
||||
// payload: {sendingRequest: true},
|
||||
// });
|
||||
|
||||
const emailAuth = yield call(AppContext.getService<EmailAuthService>().modify, ea);
|
||||
|
||||
// if (responseBody.token === undefined) {
|
||||
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||
// }
|
||||
yield put(ModifyAction.requestSuccess(emailAuth));
|
||||
} catch (e) {
|
||||
yield put(ModifyAction.requestFailure(e));
|
||||
} finally {
|
||||
// yield put({
|
||||
// type: types.SENDING_REQUEST,
|
||||
// payload: {sendingRequest: false},
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
export function* watchEmailModify(): SagaIterator {
|
||||
yield takeLatest(ModifyAction.REQUEST, modify);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,40 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 4.
|
||||
*/
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||
|
||||
|
||||
import AppContext from '@overflow/commons/context';
|
||||
import Action from '@overflow/commons/redux/Action';
|
||||
|
||||
import EmailAuth from '@overflow/email/api/model/EmailAuth';
|
||||
|
||||
import EmailAuthService from '@overflow/email/api/service/EmailAuthService';
|
||||
import * as ReadAction from '../action/read';
|
||||
import ReadPayload from '../payload/ReadPayload';
|
||||
|
||||
function* read(action: Action<ReadPayload>): SagaIterator {
|
||||
try {
|
||||
const id = action.payload.id;
|
||||
// yield put({
|
||||
// type: types.SENDING_REQUEST,
|
||||
// payload: {sendingRequest: true},
|
||||
// });
|
||||
|
||||
const emailAuth = yield call(AppContext.getService<EmailAuthService>().read, id);
|
||||
|
||||
// if (responseBody.token === undefined) {
|
||||
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||
// }
|
||||
yield put(ReadAction.requestSuccess(emailAuth));
|
||||
} catch (e) {
|
||||
yield put(ReadAction.requestFailure(e));
|
||||
} finally {
|
||||
// yield put({
|
||||
// type: types.SENDING_REQUEST,
|
||||
// payload: {sendingRequest: false},
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
export function* watchEmailRead(): SagaIterator {
|
||||
yield takeLatest(ReadAction.REQUEST, read);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,40 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 4.
|
||||
*/
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||
|
||||
|
||||
import AppContext from '@overflow/commons/context';
|
||||
import Action from '@overflow/commons/redux/Action';
|
||||
|
||||
import EmailAuth from '@overflow/email/api/model/EmailAuth';
|
||||
|
||||
import EmailAuthService from '@overflow/email/api/service/EmailAuthService';
|
||||
import * as ReadByAuthKeyAction from '../action/read_by_auth_key';
|
||||
import ReadByAuthKeyPayload from '../payload/ReadByAuthKeyPayload';
|
||||
|
||||
function* readByAuthKey(action: Action<ReadByAuthKeyPayload>): SagaIterator {
|
||||
try {
|
||||
const authKey = action.payload.authKey;
|
||||
// yield put({
|
||||
// type: types.SENDING_REQUEST,
|
||||
// payload: {sendingRequest: true},
|
||||
// });
|
||||
|
||||
const emailAuth = yield call(AppContext.getService<EmailAuthService>().readByAuthKey, authKey);
|
||||
|
||||
// if (responseBody.token === undefined) {
|
||||
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||
// }
|
||||
yield put(ReadByAuthKeyAction.requestSuccess(emailAuth));
|
||||
} catch (e) {
|
||||
yield put(ReadByAuthKeyAction.requestFailure(e));
|
||||
} finally {
|
||||
// yield put({
|
||||
// type: types.SENDING_REQUEST,
|
||||
// payload: {sendingRequest: false},
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
export function* watchReadByAuthKey(): SagaIterator {
|
||||
yield takeLatest(ReadByAuthKeyAction.REQUEST, readByAuthKey);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,40 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 4.
|
||||
*/
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||
|
||||
|
||||
import AppContext from '@overflow/commons/context';
|
||||
import Action from '@overflow/commons/redux/Action';
|
||||
|
||||
import EmailAuth from '@overflow/email/api/model/EmailAuth';
|
||||
|
||||
import EmailAuthService from '@overflow/email/api/service/EmailAuthService';
|
||||
import * as ReadByMemberAction from '../action/read_by_member';
|
||||
import ReadByMemberPayload from '../payload/ReadByMemberPayload';
|
||||
|
||||
function* readByMember(action: Action<ReadByMemberPayload>): SagaIterator {
|
||||
try {
|
||||
const id = action.payload.memberId;
|
||||
// yield put({
|
||||
// type: types.SENDING_REQUEST,
|
||||
// payload: {sendingRequest: true},
|
||||
// });
|
||||
|
||||
const emailAuths = yield call(AppContext.getService<EmailAuthService>().readByMember, id);
|
||||
|
||||
// if (responseBody.token === undefined) {
|
||||
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||
// }
|
||||
yield put(ReadByMemberAction.requestSuccess(emailAuths));
|
||||
} catch (e) {
|
||||
yield put(ReadByMemberAction.requestFailure(e));
|
||||
} finally {
|
||||
// yield put({
|
||||
// type: types.SENDING_REQUEST,
|
||||
// payload: {sendingRequest: false},
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
export function* watchReadByMember(): SagaIterator {
|
||||
yield takeLatest(ReadByMemberAction.REQUEST, readByMember);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
import { SagaIterator } from 'redux-saga';
|
||||
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||
|
||||
|
||||
import AppContext from '@overflow/commons/context';
|
||||
import Action from '@overflow/commons/redux/Action';
|
||||
|
||||
import EmailAuth from '@overflow/email/api/model/EmailAuth';
|
||||
|
||||
import EmailAuthService from '@overflow/email/api/service/EmailAuthService';
|
||||
import * as SendEmailAction from '../action/send_email_by_member';
|
||||
import SendEmailPayload from '../payload/SendEmailByMemberPayload';
|
||||
|
||||
function* sendEmail(action: Action<SendEmailPayload>): SagaIterator {
|
||||
try {
|
||||
const {memberId, email} = action.payload;
|
||||
// yield put({
|
||||
// type: types.SENDING_REQUEST,
|
||||
// payload: {sendingRequest: true},
|
||||
// });
|
||||
|
||||
const emailAuth = yield call(AppContext.getService<EmailAuthService>().sendEmailByMember, memberId, email);
|
||||
|
||||
// if (responseBody.token === undefined) {
|
||||
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||
// }
|
||||
yield put(SendEmailAction.requestSuccess(emailAuth));
|
||||
} catch (e) {
|
||||
yield put(SendEmailAction.requestFailure(e));
|
||||
} finally {
|
||||
// yield put({
|
||||
// type: types.SENDING_REQUEST,
|
||||
// payload: {sendingRequest: false},
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
export function* watchSendEmail(): SagaIterator {
|
||||
yield takeLatest(SendEmailAction.REQUEST, sendEmail);
|
||||
}
|
Loading…
Reference in New Issue
Block a user