diff --git a/src/ts/@overflow/noauthprobe/api/service/NoAuthProbeService.ts b/src/ts/@overflow/noauthprobe/api/service/NoAuthProbeService.ts index b2e35d7..1eabf6f 100644 --- a/src/ts/@overflow/noauthprobe/api/service/NoAuthProbeService.ts +++ b/src/ts/@overflow/noauthprobe/api/service/NoAuthProbeService.ts @@ -8,18 +8,18 @@ export class NoAuthProbeService extends Service { super('NoAuthProbeService'); } - public regist(noAuthProbe:NoAuthProbe): void { + public regist(noAuthProbe: NoAuthProbe): void { return null; } // Todo List - public readAllBySensor(domain:Domain): Promise { + public readAllByDomain(domain: Domain): Promise { return null; } - public read(id:string): Promise { + public read(id: number): Promise { return null; } } -export default NoAuthProbeService; \ No newline at end of file +export default NoAuthProbeService; diff --git a/src/ts/@overflow/noauthprobe/react/_ b/src/ts/@overflow/noauthprobe/react/Read.tsx similarity index 100% rename from src/ts/@overflow/noauthprobe/react/_ rename to src/ts/@overflow/noauthprobe/react/Read.tsx diff --git a/src/ts/@overflow/noauthprobe/react/components/_ b/src/ts/@overflow/noauthprobe/react/ReadAllByDomain.tsx similarity index 100% rename from src/ts/@overflow/noauthprobe/react/components/_ rename to src/ts/@overflow/noauthprobe/react/ReadAllByDomain.tsx diff --git a/src/ts/@overflow/noauthprobe/redux/state/ReadAllBySensor.ts b/src/ts/@overflow/noauthprobe/react/Regist.tsx similarity index 100% rename from src/ts/@overflow/noauthprobe/redux/state/ReadAllBySensor.ts rename to src/ts/@overflow/noauthprobe/react/Regist.tsx diff --git a/src/ts/@overflow/noauthprobe/react/components/Read.tsx b/src/ts/@overflow/noauthprobe/react/components/Read.tsx new file mode 100644 index 0000000..e69de29 diff --git a/src/ts/@overflow/noauthprobe/react/components/ReadAllByDomain.tsx b/src/ts/@overflow/noauthprobe/react/components/ReadAllByDomain.tsx new file mode 100644 index 0000000..e69de29 diff --git a/src/ts/@overflow/noauthprobe/react/components/Regist.tsx b/src/ts/@overflow/noauthprobe/react/components/Regist.tsx new file mode 100644 index 0000000..e69de29 diff --git a/src/ts/@overflow/noauthprobe/redux/action/read.ts b/src/ts/@overflow/noauthprobe/redux/action/read.ts index 5c15c15..e1f394a 100644 --- a/src/ts/@overflow/noauthprobe/redux/action/read.ts +++ b/src/ts/@overflow/noauthprobe/redux/action/read.ts @@ -1,3 +1,43 @@ -/** - * Created by geek on 17. 7. 3. - */ +import Action from '@overflow/commons/redux/Action'; +import NoAuthProbe from '../..//api/model/NoAuthProbe'; + +import ReadPayload from '../payload/ReadPayload'; + +// Action Type +export type REQUEST = '@overflow/noAuthProbe/read/REQUEST'; +export type REQUEST_SUCCESS = '@overflow/noAuthProbe/read/REQUEST_SUCCESS'; +export type REQUEST_FAILURE = '@overflow/noAuthProbe/read/REQUEST_FAILURE'; + +export const REQUEST: REQUEST = '@overflow/noAuthProbe/read/REQUEST'; +export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/noAuthProbe/read/REQUEST_SUCCESS'; +export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/noAuthProbe/read/REQUEST_FAILURE'; + +// Action Creater +export type request = (id: number) => Action; +export type requestSuccess = (noAuthProbe: NoAuthProbe) => Action; +export type requestFailure = (error: Error) => Action; + + + +export const request: request = (id: number): Action => { + return { + type: REQUEST, + payload: { + id:id, + }, + }; +}; + +export const requestSuccess: requestSuccess = (noAuthProbe: NoAuthProbe): Action => { + return { + type: REQUEST_SUCCESS, + payload: noAuthProbe, + }; +}; + +export const requestFailure: requestFailure = (error: Error): Action => { + return { + type: REQUEST_FAILURE, + error: error, + }; +}; diff --git a/src/ts/@overflow/noauthprobe/redux/action/read_all_by_domain.ts b/src/ts/@overflow/noauthprobe/redux/action/read_all_by_domain.ts new file mode 100644 index 0000000..e73182c --- /dev/null +++ b/src/ts/@overflow/noauthprobe/redux/action/read_all_by_domain.ts @@ -0,0 +1,44 @@ +import Action from '@overflow/commons/redux/Action'; +import NoAuthProbe from '../../api/model/NoAuthProbe'; +import Domain from '@overflow/domain/api/model/Domain'; + +import ReadAllByDomainPayload from '../payload/ReadAllByDomainPayload'; + +// Action Type +export type REQUEST = '@overflow/noAuthProbe/readAllByDomain/REQUEST'; +export type REQUEST_SUCCESS = '@overflow/noAuthProbe/readAllByDomain/REQUEST_SUCCESS'; +export type REQUEST_FAILURE = '@overflow/noAuthProbe/readAllByDomain/REQUEST_FAILURE'; + +export const REQUEST: REQUEST = '@overflow/noAuthProbe/readAllByDomain/REQUEST'; +export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/noAuthProbe/readAllByDomain/REQUEST_SUCCESS'; +export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/noAuthProbe/readAllByDomain/REQUEST_FAILURE'; + +// Action Creater +export type request = (domain: Domain) => Action; +export type requestSuccess = (noAuthProbe: NoAuthProbe) => Action; +export type requestFailure = (error: Error) => Action; + + + +export const request: request = (domain: Domain): Action => { + return { + type: REQUEST, + payload: { + domain:domain, + }, + }; +}; + +export const requestSuccess: requestSuccess = (noAuthProbe: NoAuthProbe): Action => { + return { + type: REQUEST_SUCCESS, + payload: noAuthProbe, + }; +}; + +export const requestFailure: requestFailure = (error: Error): Action => { + return { + type: REQUEST_FAILURE, + error: error, + }; +}; diff --git a/src/ts/@overflow/noauthprobe/redux/action/regist.ts b/src/ts/@overflow/noauthprobe/redux/action/regist.ts index e69de29..9ba9848 100644 --- a/src/ts/@overflow/noauthprobe/redux/action/regist.ts +++ b/src/ts/@overflow/noauthprobe/redux/action/regist.ts @@ -0,0 +1,43 @@ +import Action from '@overflow/commons/redux/Action'; +import NoAuthProbe from '../..//api/model/NoAuthProbe'; + +import RegistPayload from '../payload/RegistPayload'; + +// Action Type +export type REQUEST = '@overflow/noAuthProbe/regist/REQUEST'; +export type REQUEST_SUCCESS = '@overflow/noAuthProbe/regist/REQUEST_SUCCESS'; +export type REQUEST_FAILURE = '@overflow/noAuthProbe/regist/REQUEST_FAILURE'; + +export const REQUEST: REQUEST = '@overflow/noAuthProbe/regist/REQUEST'; +export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/noAuthProbe/regist/REQUEST_SUCCESS'; +export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/noAuthProbe/regist/REQUEST_FAILURE'; + +// Action Creater +export type request = (noAuthProbe: NoAuthProbe) => Action; +export type requestSuccess = (noAuthProbe: NoAuthProbe) => Action; +export type requestFailure = (error: Error) => Action; + + + +export const request: request = (noAuthProbe: NoAuthProbe): Action => { + return { + type: REQUEST, + payload: { + noAuthProbe:noAuthProbe, + }, + }; +}; + +export const requestSuccess: requestSuccess = (noAuthProbe: NoAuthProbe): Action => { + return { + type: REQUEST_SUCCESS, + payload: noAuthProbe, + }; +}; + +export const requestFailure: requestFailure = (error: Error): Action => { + return { + type: REQUEST_FAILURE, + error: error, + }; +}; diff --git a/src/ts/@overflow/noauthprobe/redux/payload/ReadAllByDomainPayload.ts b/src/ts/@overflow/noauthprobe/redux/payload/ReadAllByDomainPayload.ts new file mode 100644 index 0000000..3234527 --- /dev/null +++ b/src/ts/@overflow/noauthprobe/redux/payload/ReadAllByDomainPayload.ts @@ -0,0 +1,7 @@ +import Domain from '@overflow/domain/api/model/Domain'; + +interface ReadAllByDomainPayload { + domain: Domain; +} + +export default ReadAllByDomainPayload; diff --git a/src/ts/@overflow/noauthprobe/redux/payload/ReadAllBySensorPayload.ts b/src/ts/@overflow/noauthprobe/redux/payload/ReadAllBySensorPayload.ts deleted file mode 100644 index 5c15c15..0000000 --- a/src/ts/@overflow/noauthprobe/redux/payload/ReadAllBySensorPayload.ts +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Created by geek on 17. 7. 3. - */ diff --git a/src/ts/@overflow/noauthprobe/redux/payload/ReadPayload.ts b/src/ts/@overflow/noauthprobe/redux/payload/ReadPayload.ts index e69de29..7fda332 100644 --- a/src/ts/@overflow/noauthprobe/redux/payload/ReadPayload.ts +++ b/src/ts/@overflow/noauthprobe/redux/payload/ReadPayload.ts @@ -0,0 +1,7 @@ + + +interface ReadPayload { + id: number; +} + +export default ReadPayload; diff --git a/src/ts/@overflow/noauthprobe/redux/payload/RegistPayload.ts b/src/ts/@overflow/noauthprobe/redux/payload/RegistPayload.ts index 5c15c15..3a13ee0 100644 --- a/src/ts/@overflow/noauthprobe/redux/payload/RegistPayload.ts +++ b/src/ts/@overflow/noauthprobe/redux/payload/RegistPayload.ts @@ -1,3 +1,7 @@ -/** - * Created by geek on 17. 7. 3. - */ +import NoAuthProbe from '../../api/model/NoAuthProbe'; + +interface RegistPayload { + noAuthProbe: NoAuthProbe; +} + +export default RegistPayload; diff --git a/src/ts/@overflow/noauthprobe/redux/action/read_all_by_sensor.ts b/src/ts/@overflow/noauthprobe/redux/reducer/read_all_by_domain.ts similarity index 100% rename from src/ts/@overflow/noauthprobe/redux/action/read_all_by_sensor.ts rename to src/ts/@overflow/noauthprobe/redux/reducer/read_all_by_domain.ts diff --git a/src/ts/@overflow/noauthprobe/redux/reducer/read_all_by_sensor.ts b/src/ts/@overflow/noauthprobe/redux/reducer/read_all_by_sensor.ts deleted file mode 100644 index 5c15c15..0000000 --- a/src/ts/@overflow/noauthprobe/redux/reducer/read_all_by_sensor.ts +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Created by geek on 17. 7. 3. - */ diff --git a/src/ts/@overflow/noauthprobe/redux/saga/read.ts b/src/ts/@overflow/noauthprobe/redux/saga/read.ts index 5c15c15..2532740 100644 --- a/src/ts/@overflow/noauthprobe/redux/saga/read.ts +++ b/src/ts/@overflow/noauthprobe/redux/saga/read.ts @@ -1,3 +1,39 @@ -/** - * Created by geek on 17. 7. 3. - */ +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 NoAuthProbe from '../../api/model/NoAuthProbe'; +import NoAuthProbeService from '../../api/service/NoAuthProbeService'; +import * as ReadActions from '../action/read'; +import ReadPayload from '../payload/ReadPayload'; + +function* read(action: Action): SagaIterator { + try { + const {id} = action.payload; + // yield put({ + // type: types.SENDING_REQUEST, + // payload: {sendingRequest: true}, + // }); + + const retApikey = yield call(AppContext.getService().read, id); + + // if (responseBody.token === undefined) { + // throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE); + // } + yield put(ReadActions.requestSuccess(retApikey)); + } catch (e) { + yield put(ReadActions.requestFailure(e)); + } finally { + // yield put({ + // type: types.SENDING_REQUEST, + // payload: {sendingRequest: false}, + // }); + } +} + +export function* watchRead(): SagaIterator { + yield takeLatest(ReadActions.REQUEST, read); +} diff --git a/src/ts/@overflow/noauthprobe/redux/saga/read_all_by_domain.ts b/src/ts/@overflow/noauthprobe/redux/saga/read_all_by_domain.ts new file mode 100644 index 0000000..7a9d67a --- /dev/null +++ b/src/ts/@overflow/noauthprobe/redux/saga/read_all_by_domain.ts @@ -0,0 +1,39 @@ +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 NoAuthProbe from '../../api/model/NoAuthProbe'; +import NoAuthProbeService from '../../api/service/NoAuthProbeService'; +import * as ReadActions from '../action/read_all_by_domain'; +import ReadAllByDomainPayload from '../payload/ReadAllByDomainPayload'; + +function* readAllByDomain(action: Action): SagaIterator { + try { + const {domain} = action.payload; + // yield put({ + // type: types.SENDING_REQUEST, + // payload: {sendingRequest: true}, + // }); + + const retApikey = yield call(AppContext.getService().readAllByDomain, domain); + + // if (responseBody.token === undefined) { + // throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE); + // } + yield put(ReadActions.requestSuccess(retApikey)); + } catch (e) { + yield put(ReadActions.requestFailure(e)); + } finally { + // yield put({ + // type: types.SENDING_REQUEST, + // payload: {sendingRequest: false}, + // }); + } +} + +export function* watchReadAllByDomain(): SagaIterator { + yield takeLatest(ReadActions.REQUEST, readAllByDomain); +} diff --git a/src/ts/@overflow/noauthprobe/redux/saga/read_all_by_sensor.ts b/src/ts/@overflow/noauthprobe/redux/saga/read_all_by_sensor.ts deleted file mode 100644 index 5c15c15..0000000 --- a/src/ts/@overflow/noauthprobe/redux/saga/read_all_by_sensor.ts +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Created by geek on 17. 7. 3. - */ diff --git a/src/ts/@overflow/noauthprobe/redux/saga/regist.ts b/src/ts/@overflow/noauthprobe/redux/saga/regist.ts index e69de29..f4fde00 100644 --- a/src/ts/@overflow/noauthprobe/redux/saga/regist.ts +++ b/src/ts/@overflow/noauthprobe/redux/saga/regist.ts @@ -0,0 +1,39 @@ +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 NoAuthProbe from '../../api/model/NoAuthProbe'; +import NoAuthProbeService from '../../api/service/NoAuthProbeService'; +import * as RegistActions from '../action/regist'; +import RegistPayload from '../payload/RegistPayload'; + +function* regist(action: Action): SagaIterator { + try { + const {noAuthProbe} = action.payload; + // yield put({ + // type: types.SENDING_REQUEST, + // payload: {sendingRequest: true}, + // }); + + const retApikey = yield call(AppContext.getService().regist, noAuthProbe); + + // if (responseBody.token === undefined) { + // throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE); + // } + yield put(RegistActions.requestSuccess(retApikey)); + } catch (e) { + yield put(RegistActions.requestFailure(e)); + } finally { + // yield put({ + // type: types.SENDING_REQUEST, + // payload: {sendingRequest: false}, + // }); + } +} + +export function* watchRegist(): SagaIterator { + yield takeLatest(RegistActions.REQUEST, regist); +} diff --git a/src/ts/@overflow/noauthprobe/redux/state/ReadAllByDomain.ts b/src/ts/@overflow/noauthprobe/redux/state/ReadAllByDomain.ts new file mode 100644 index 0000000..e69de29