diff --git a/pom.xml b/pom.xml
index 0326f471..639db9ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
no.priv.bang.pom
bang-authservice-client-pom
- 1.1.48
+ 1.1.49
no.priv.bang.ukelonn
ukelonn
diff --git a/ukelonn.testutils/src/main/java/no/priv/bang/ukelonn/testutils/TestUtils.java b/ukelonn.testutils/src/main/java/no/priv/bang/ukelonn/testutils/TestUtils.java
index 94805813..c2782784 100644
--- a/ukelonn.testutils/src/main/java/no/priv/bang/ukelonn/testutils/TestUtils.java
+++ b/ukelonn.testutils/src/main/java/no/priv/bang/ukelonn/testutils/TestUtils.java
@@ -28,10 +28,9 @@
import java.util.stream.Stream;
import org.apache.shiro.authc.SimpleAccount;
-import org.apache.shiro.config.Ini;
import org.apache.shiro.mgt.RealmSecurityManager;
import org.apache.shiro.realm.SimpleAccountRealm;
-import org.apache.shiro.web.config.WebIniSecurityManagerFactory;
+import org.apache.shiro.web.env.IniWebEnvironment;
import org.apache.shiro.web.mgt.WebSecurityManager;
import no.priv.bang.ukelonn.beans.Account;
import no.priv.bang.ukelonn.beans.Transaction;
@@ -122,8 +121,10 @@ public class TestUtils {
public static WebSecurityManager getSecurityManager() {
if (securitymanager == null) {
- var securityManagerFactory = new WebIniSecurityManagerFactory(Ini.fromResourcePath("classpath:test.shiro.ini"));
- securitymanager = (WebSecurityManager) securityManagerFactory.getInstance();
+ var env = new IniWebEnvironment();
+ env.setConfigLocations("classpath:test.shiro.ini");
+ env.init();
+ securitymanager = env.getWebSecurityManager();
realm = findRealmFromSecurityManager(securitymanager);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/accountSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/accountSaga.js
index 22c2b11b..b187d776 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/accountSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/accountSaga.js
@@ -14,9 +14,10 @@ import {
import { emptyAccount } from '../constants';
import { findUsername } from '../common/login';
-
-function doAccount(username) {
- return axios.get('/api/account/' + username );
+export default function* accountSaga() {
+ yield takeLatest(SELECT_ACCOUNT, fetchDataForSelectedAccount);
+ yield takeLatest(ACCOUNT_REQUEST, requestReceiveAccountSaga);
+ yield takeLatest(RECEIVED_NOTIFICATION, updateAccountOnNotification);
}
function* requestReceiveAccountSaga(action) {
@@ -34,6 +35,10 @@ function* requestReceiveAccountSaga(action) {
}
}
+function doAccount(username) {
+ return axios.get('/api/account/' + username );
+}
+
function* fetchDataForSelectedAccount(action) {
const { accountId, username } = action.payload;
if (accountId !== -1) {
@@ -52,9 +57,3 @@ function* updateAccountOnNotification() {
const username = yield select(findUsername);
yield put(ACCOUNT_REQUEST(username));
}
-
-export default function* accountSaga() {
- yield takeLatest(SELECT_ACCOUNT, fetchDataForSelectedAccount);
- yield takeLatest(ACCOUNT_REQUEST, requestReceiveAccountSaga);
- yield takeLatest(RECEIVED_NOTIFICATION, updateAccountOnNotification);
-}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/accountsSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/accountsSaga.js
index 8c9af3fd..577cee2f 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/accountsSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/accountsSaga.js
@@ -6,8 +6,8 @@ import {
ACCOUNTS_FAILURE,
} from '../actiontypes';
-function doAccounts() {
- return axios.get('/api/accounts');
+export default function* accountsSaga() {
+ yield takeLatest(ACCOUNTS_REQUEST, requestReceiveAccountsSaga);
}
function* requestReceiveAccountsSaga() {
@@ -20,6 +20,6 @@ function* requestReceiveAccountsSaga() {
}
}
-export default function* accountsSaga() {
- yield takeLatest(ACCOUNTS_REQUEST, requestReceiveAccountsSaga);
+function doAccounts() {
+ return axios.get('/api/accounts');
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/activebonusesSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/activebonusesSaga.js
index 8466c026..30b619c8 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/activebonusesSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/activebonusesSaga.js
@@ -11,10 +11,6 @@ export function* requestActivebonusesSaga() {
yield takeLatest(GET_ACTIVE_BONUSES, receiveActivebonusesSaga);
}
-function doActivebonuses() {
- return axios.get('/api/activebonuses');
-}
-
// worker saga
function* receiveActivebonusesSaga() {
try {
@@ -25,3 +21,7 @@ function* receiveActivebonusesSaga() {
yield put(RECEIVE_ACTIVE_BONUSES_FAILURE(error));
}
}
+
+function doActivebonuses() {
+ return axios.get('/api/activebonuses');
+}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/adminstatusSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/adminstatusSaga.js
index 93a06cb5..97272086 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/adminstatusSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/adminstatusSaga.js
@@ -6,6 +6,10 @@ import {
RECEIVE_ADMIN_STATUS_ERROR,
} from '../actiontypes';
+export default function* adminStatusSaga() {
+ yield takeLatest(REQUEST_ADMIN_STATUS, requestAdminStatus);
+}
+
function* requestAdminStatus(action) {
try {
const response = yield call(fetchAdminStatus, action.payload);
@@ -19,7 +23,3 @@ function* requestAdminStatus(action) {
function fetchAdminStatus(user) {
return axios.post('/api/admin/user/adminstatus', user);
}
-
-export default function* adminStatusSaga() {
- yield takeLatest(REQUEST_ADMIN_STATUS, requestAdminStatus);
-}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/allbonusesSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/allbonusesSaga.js
index 4b5995b2..90f1e37b 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/allbonusesSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/allbonusesSaga.js
@@ -11,10 +11,6 @@ export function* requestAllbonusesSaga() {
yield takeLatest(GET_ALL_BONUSES, receiveAllbonusesSaga);
}
-function doAllbonuses() {
- return axios.get('/api/allbonuses');
-}
-
// worker saga
function* receiveAllbonusesSaga() {
try {
@@ -25,3 +21,7 @@ function* receiveAllbonusesSaga() {
yield put(RECEIVE_ALL_BONUSES_FAILURE(error));
}
}
+
+function doAllbonuses() {
+ return axios.get('/api/allbonuses');
+}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/availableLocalesSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/availableLocalesSaga.js
index 2916dcc6..a57e6bf7 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/availableLocalesSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/availableLocalesSaga.js
@@ -11,10 +11,6 @@ export default function* availableLocalesSaga() {
yield takeLatest(AVAILABLE_LOCALES_REQUEST, receiveAvailableLocalesSaga);
}
-function doAvailableLocales() {
- return axios.get('/api/availablelocales');
-}
-
// worker saga
function* receiveAvailableLocalesSaga() {
try {
@@ -25,3 +21,7 @@ function* receiveAvailableLocalesSaga() {
yield put(AVAILABLE_LOCALES_ERROR(error));
}
}
+
+function doAvailableLocales() {
+ return axios.get('/api/availablelocales');
+}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/bonusSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/bonusSaga.js
index 66ea6933..1539a78c 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/bonusSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/bonusSaga.js
@@ -14,6 +14,16 @@ import {
CLEAR_BONUS,
} from '../actiontypes';
+export default function* bonusSaga() {
+ yield takeLatest(SELECT_BONUS, selectBonus);
+ yield takeLatest(SAVE_BONUS_CHANGES_BUTTON_CLICKED, saveModifiedBonus);
+ yield takeLatest(CREATE_NEW_BONUS_BUTTON_CLICKED, saveCreatedBonus);
+ yield takeLatest(DELETE_SELECTED_BONUS_BUTTON_CLICKED, deleteSelectedBonus);
+ yield takeLatest(MODIFY_BONUS_RECEIVE, clearBonusForm);
+ yield takeLatest(CREATE_BONUS_RECEIVE, clearBonusForm);
+ yield takeLatest(DELETE_BONUS_RECEIVE, clearBonusForm);
+}
+
function* selectBonus(action) {
const bonusId = action.payload;
if (bonusId === -1) {
@@ -63,13 +73,3 @@ function* deleteSelectedBonus() {
function* clearBonusForm() {
yield put(CLEAR_BONUS());
}
-
-export default function* bonusSaga() {
- yield takeLatest(SELECT_BONUS, selectBonus);
- yield takeLatest(SAVE_BONUS_CHANGES_BUTTON_CLICKED, saveModifiedBonus);
- yield takeLatest(CREATE_NEW_BONUS_BUTTON_CLICKED, saveCreatedBonus);
- yield takeLatest(DELETE_SELECTED_BONUS_BUTTON_CLICKED, deleteSelectedBonus);
- yield takeLatest(MODIFY_BONUS_RECEIVE, clearBonusForm);
- yield takeLatest(CREATE_BONUS_RECEIVE, clearBonusForm);
- yield takeLatest(DELETE_BONUS_RECEIVE, clearBonusForm);
-}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/changeUserPasswordSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/changeUserPasswordSaga.js
index d0b4fe05..7b59ffed 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/changeUserPasswordSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/changeUserPasswordSaga.js
@@ -6,8 +6,8 @@ import {
CHANGE_USER_PASSWORD_FAILURE,
} from '../actiontypes';
-function doChangePassword(passwords) {
- return axios.post('/api/admin/user/password', passwords);
+export default function* changeUserPasswordSaga() {
+ yield takeLatest(CHANGE_USER_PASSWORD_REQUEST, requestReceiveChangePasswordSaga);
}
function* requestReceiveChangePasswordSaga(action) {
@@ -20,6 +20,6 @@ function* requestReceiveChangePasswordSaga(action) {
}
}
-export default function* changeUserPasswordSaga() {
- yield takeLatest(CHANGE_USER_PASSWORD_REQUEST, requestReceiveChangePasswordSaga);
+function doChangePassword(passwords) {
+ return axios.post('/api/admin/user/password', passwords);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/changeadminstatusSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/changeadminstatusSaga.js
index fd5c560c..d755fc90 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/changeadminstatusSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/changeadminstatusSaga.js
@@ -6,8 +6,8 @@ import {
CHANGE_ADMIN_STATUS_ERROR,
} from '../actiontypes';
-function fetchAdminStatus(user) {
- return axios.post('/api/admin/user/changeadminstatus', user);
+export default function* () {
+ yield takeLatest(CHANGE_ADMIN_STATUS, changeAdminStatus);
}
function* changeAdminStatus(action) {
@@ -21,6 +21,6 @@ function* changeAdminStatus(action) {
}
}
-export default function* () {
- yield takeLatest(CHANGE_ADMIN_STATUS, changeAdminStatus);
+function fetchAdminStatus(user) {
+ return axios.post('/api/admin/user/changeadminstatus', user);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/createBonusSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/createBonusSaga.js
index 2177e401..32ccabd6 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/createBonusSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/createBonusSaga.js
@@ -6,8 +6,8 @@ import {
CREATE_BONUS_FAILURE,
} from '../actiontypes';
-function doCreateBonus(bonus) {
- return axios.post('/api/admin/createbonus', bonus);
+export default function* createBonusSaga() {
+ yield takeLatest(CREATE_BONUS_REQUEST, requestReceiveCreateBonusSaga);
}
function* requestReceiveCreateBonusSaga(action) {
@@ -20,6 +20,6 @@ function* requestReceiveCreateBonusSaga(action) {
}
}
-export default function* createBonusSaga() {
- yield takeLatest(CREATE_BONUS_REQUEST, requestReceiveCreateBonusSaga);
+function doCreateBonus(bonus) {
+ return axios.post('/api/admin/createbonus', bonus);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/createJobtypeSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/createJobtypeSaga.js
index 9fa8583b..45be3888 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/createJobtypeSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/createJobtypeSaga.js
@@ -6,8 +6,8 @@ import {
CREATE_JOBTYPE_FAILURE,
} from '../actiontypes';
-function doCreateJobtype(jobtype) {
- return axios.post('/api/admin/jobtype/create', jobtype);
+export default function* createJobtypeSaga() {
+ yield takeLatest(CREATE_JOBTYPE_REQUEST, sendReceiveCreateJobtype);
}
function* sendReceiveCreateJobtype(action) {
@@ -20,6 +20,6 @@ function* sendReceiveCreateJobtype(action) {
}
}
-export default function* createJobtypeSaga() {
- yield takeLatest(CREATE_JOBTYPE_REQUEST, sendReceiveCreateJobtype);
+function doCreateJobtype(jobtype) {
+ return axios.post('/api/admin/jobtype/create', jobtype);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/createPaymenttypeSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/createPaymenttypeSaga.js
index 9bd4f959..39055696 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/createPaymenttypeSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/createPaymenttypeSaga.js
@@ -6,8 +6,8 @@ import {
CREATE_PAYMENTTYPE_FAILURE,
} from '../actiontypes';
-function doCreatePaymenttype(paymenttype) {
- return axios.post('/api/admin/paymenttype/create', paymenttype);
+export default function* createPaymenttypeSaga() {
+ yield takeLatest(CREATE_PAYMENTTYPE_REQUEST, requestReceiveCreatePaymenttype);
}
function* requestReceiveCreatePaymenttype(action) {
@@ -20,6 +20,6 @@ function* requestReceiveCreatePaymenttype(action) {
}
}
-export default function* createPaymenttypeSaga() {
- yield takeLatest(CREATE_PAYMENTTYPE_REQUEST, requestReceiveCreatePaymenttype);
+function doCreatePaymenttype(paymenttype) {
+ return axios.post('/api/admin/paymenttype/create', paymenttype);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/createUserSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/createUserSaga.js
index b5969b5f..1e86f85a 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/createUserSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/createUserSaga.js
@@ -6,9 +6,8 @@ import {
CREATE_USER_FAILURE,
} from '../actiontypes';
-function doCreateUser(passwords) {
- delete passwords.user.fullname;
- return axios.post('/api/admin/user/create', passwords);
+export default function* createUserSaga() {
+ yield takeLatest(CREATE_USER_REQUEST, requestReceiveCreateUserSaga);
}
function* requestReceiveCreateUserSaga(action) {
@@ -21,6 +20,7 @@ function* requestReceiveCreateUserSaga(action) {
}
}
-export default function* createUserSaga() {
- yield takeLatest(CREATE_USER_REQUEST, requestReceiveCreateUserSaga);
+function doCreateUser(passwords) {
+ delete passwords.user.fullname;
+ return axios.post('/api/admin/user/create', passwords);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/defaultLocaleSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/defaultLocaleSaga.js
index 88d0a571..10b7b67a 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/defaultLocaleSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/defaultLocaleSaga.js
@@ -11,10 +11,6 @@ export default function* defaultLocaleSaga() {
yield takeLatest(DEFAULT_LOCALE_REQUEST, receiveDefaultLocaleSaga);
}
-function doDefaultLocale() {
- return axios.get('/api/defaultlocale');
-}
-
// worker saga
function* receiveDefaultLocaleSaga() {
try {
@@ -25,3 +21,7 @@ function* receiveDefaultLocaleSaga() {
yield put(DEFAULT_LOCALE_ERROR(error));
}
}
+
+function doDefaultLocale() {
+ return axios.get('/api/defaultlocale');
+}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/deleteBonusSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/deleteBonusSaga.js
index bdee3147..ffce14c4 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/deleteBonusSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/deleteBonusSaga.js
@@ -6,8 +6,8 @@ import {
DELETE_BONUS_FAILURE,
} from '../actiontypes';
-function doDeleteBonus(bonus) {
- return axios.post('/api/admin/deletebonus', bonus);
+export default function* deleteBonusSaga() {
+ yield takeLatest(DELETE_BONUS_REQUEST, receiveDeleteBonusSaga);
}
function* receiveDeleteBonusSaga(action) {
@@ -20,6 +20,6 @@ function* receiveDeleteBonusSaga(action) {
}
}
-export default function* deleteBonusSaga() {
- yield takeLatest(DELETE_BONUS_REQUEST, receiveDeleteBonusSaga);
+function doDeleteBonus(bonus) {
+ return axios.post('/api/admin/deletebonus', bonus);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/deleteJobsSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/deleteJobsSaga.js
index ab98b179..4f1dbf31 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/deleteJobsSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/deleteJobsSaga.js
@@ -6,8 +6,8 @@ import {
DELETE_JOBS_FAILURE,
} from '../actiontypes';
-function doDeleteJobs(accountWithJobIds) {
- return axios.post('/api/admin/jobs/delete', accountWithJobIds);
+export default function* deleteJobsSaga() {
+ yield takeLatest(DELETE_JOBS_REQUEST, requestReceiveDeleteJobsSaga);
}
function* requestReceiveDeleteJobsSaga(action) {
@@ -23,6 +23,6 @@ function* requestReceiveDeleteJobsSaga(action) {
}
}
-export default function* deleteJobsSaga() {
- yield takeLatest(DELETE_JOBS_REQUEST, requestReceiveDeleteJobsSaga);
+function doDeleteJobs(accountWithJobIds) {
+ return axios.post('/api/admin/jobs/delete', accountWithJobIds);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/displayTextsSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/displayTextsSaga.js
index f385fef3..033991c6 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/displayTextsSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/displayTextsSaga.js
@@ -14,10 +14,6 @@ export default function* displayTextsSaga() {
yield takeLatest(UPDATE_LOCALE, receiveDisplayTextsSaga);
}
-function doDisplayTexts(locale) {
- return axios.get('/api/displaytexts?' + stringify({ locale }));
-}
-
// worker saga
function* receiveDisplayTextsSaga(action) {
try {
@@ -28,3 +24,7 @@ function* receiveDisplayTextsSaga(action) {
yield put(DISPLAY_TEXTS_ERROR(error));
}
}
+
+function doDisplayTexts(locale) {
+ return axios.get('/api/displaytexts?' + stringify({ locale }));
+}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/earningsSumOverMonthSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/earningsSumOverMonthSaga.js
index e545331e..9dc453b4 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/earningsSumOverMonthSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/earningsSumOverMonthSaga.js
@@ -1,4 +1,4 @@
-import { all, takeLatest, call, put } from 'redux-saga/effects';
+import { takeLatest, call, put } from 'redux-saga/effects';
import axios from 'axios';
import {
EARNINGS_SUM_OVER_MONTH_REQUEST,
@@ -6,8 +6,9 @@ import {
EARNINGS_SUM_OVER_MONTH_FAILURE,
} from '../actiontypes';
-function doEarningsSumOverMonth(username) {
- return axios.get('/api/statistics/earnings/sumovermonth/' + username);
+// watcher saga
+export default function* earningsSumOverMonthSaga() {
+ yield takeLatest(EARNINGS_SUM_OVER_MONTH_REQUEST, receiveEarningsSumOverMonthSaga);
}
// worker saga
@@ -22,9 +23,6 @@ function* receiveEarningsSumOverMonthSaga(action) {
}
}
-// watcher saga
-export default function* earningsSumOverMonthSaga() {
- yield all([
- yield takeLatest(EARNINGS_SUM_OVER_MONTH_REQUEST, receiveEarningsSumOverMonthSaga),
- ]);
+function doEarningsSumOverMonth(username) {
+ return axios.get('/api/statistics/earnings/sumovermonth/' + username);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/earningsSumOverYearSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/earningsSumOverYearSaga.js
index 2db1cd26..0305d7f7 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/earningsSumOverYearSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/earningsSumOverYearSaga.js
@@ -6,8 +6,11 @@ import {
EARNINGS_SUM_OVER_YEAR_FAILURE,
} from '../actiontypes';
-function doEarningsSumOverYear(username) {
- return axios.get('/api/statistics/earnings/sumoveryear/' + username);
+// watcher saga
+export default function* earningsSumOverYearSaga() {
+ yield all([
+ takeLatest(EARNINGS_SUM_OVER_YEAR_REQUEST, receiveEarningsSumOverYearSaga),
+ ]);
}
// worker saga
@@ -22,9 +25,6 @@ function* receiveEarningsSumOverYearSaga(action) {
}
}
-// watcher saga
-export default function* earningsSumOverYearSaga() {
- yield all([
- takeLatest(EARNINGS_SUM_OVER_YEAR_REQUEST, receiveEarningsSumOverYearSaga),
- ]);
+function doEarningsSumOverYear(username) {
+ return axios.get('/api/statistics/earnings/sumoveryear/' + username);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/index.js b/ukelonn.web.frontend/src/main/frontend/sagas/index.js
index fcdce97b..4214d970 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/index.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/index.js
@@ -1,5 +1,5 @@
import { fork, all } from 'redux-saga/effects';
-import { requestInitialLoginStateSaga, requestCheckLoginStateSaga, requestLoginSaga } from './loginSaga';
+import loginSaga from './loginSaga';
import logoutSaga from './logoutSaga';
import reloadSaga from './reloadSaga';
import locationSaga from './locationSaga';
@@ -46,9 +46,7 @@ import checkLoginOnApiErrorSaga from './checkLoginOnApiErrorSaga';
export function* rootSaga() {
yield all([
- fork(requestInitialLoginStateSaga),
- fork(requestCheckLoginStateSaga),
- fork(requestLoginSaga),
+ fork(loginSaga),
fork(logoutSaga),
fork(reloadSaga),
fork(locationSaga),
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/jobSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/jobSaga.js
index b2c58cff..cfe78152 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/jobSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/jobSaga.js
@@ -14,6 +14,14 @@ import {
CLEAR_EDIT_JOB_FORM,
} from '../actiontypes';
+export default function* jobSaga() {
+ yield takeLatest(REGISTER_JOB_BUTTON_CLICKED, registerPerformedJob);
+ yield takeLatest(SAVE_CHANGES_TO_JOB_BUTTON_CLICKED, buildRequestAndSaveModifiedJob);
+ yield takeLatest(DELETE_SELECTED_JOBS_BUTTON_CLICKED, deleteSelectedJobs);
+ yield takeLatest(REGISTERJOB_RECEIVE, fetchUpdatedSumsAndClearRegisterJobForm);
+ yield takeLatest(UPDATE_JOB_RECEIVE, clearEditJobForm);
+}
+
function* registerPerformedJob() {
const job = yield select(state => ({
account: {
@@ -56,11 +64,3 @@ function* fetchUpdatedSumsAndClearRegisterJobForm(action) {
function* clearEditJobForm() {
yield put(CLEAR_EDIT_JOB_FORM());
}
-
-export default function* jobSaga() {
- yield takeLatest(REGISTER_JOB_BUTTON_CLICKED, registerPerformedJob);
- yield takeLatest(SAVE_CHANGES_TO_JOB_BUTTON_CLICKED, buildRequestAndSaveModifiedJob);
- yield takeLatest(DELETE_SELECTED_JOBS_BUTTON_CLICKED, deleteSelectedJobs);
- yield takeLatest(REGISTERJOB_RECEIVE, fetchUpdatedSumsAndClearRegisterJobForm);
- yield takeLatest(UPDATE_JOB_RECEIVE, clearEditJobForm);
-}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/jobtypeSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/jobtypeSaga.js
index d0c1f81d..275151f8 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/jobtypeSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/jobtypeSaga.js
@@ -12,6 +12,14 @@ import {
CLEAR_JOB_TYPE_CREATE_FORM,
} from '../actiontypes';
+export default function* jobtypeSaga() {
+ yield takeLatest(SELECT_JOB_TYPE, selectJobType);
+ yield takeLatest(SAVE_CHANGES_TO_JOB_TYPE_BUTTON_CLICKED, buildRequestAndSaveModifiedJobType);
+ yield takeLatest(CREATE_NEW_JOB_TYPE_BUTTON_CLICKED, buildRequestAndSaveCreatedJobType);
+ yield takeLatest(MODIFY_JOBTYPE_RECEIVE, clearJobtypeForm);
+ yield takeLatest(CREATE_JOBTYPE_RECEIVE, clearJobtypeCreateForm);
+}
+
function* selectJobType(action) {
const transactionTypeId = action.payload;
if (transactionTypeId === -1) {
@@ -49,11 +57,3 @@ function* clearJobtypeForm() {
function* clearJobtypeCreateForm() {
yield put(CLEAR_JOB_TYPE_CREATE_FORM());
}
-
-export default function* jobtypeSaga() {
- yield takeLatest(SELECT_JOB_TYPE, selectJobType);
- yield takeLatest(SAVE_CHANGES_TO_JOB_TYPE_BUTTON_CLICKED, buildRequestAndSaveModifiedJobType);
- yield takeLatest(CREATE_NEW_JOB_TYPE_BUTTON_CLICKED, buildRequestAndSaveCreatedJobType);
- yield takeLatest(MODIFY_JOBTYPE_RECEIVE, clearJobtypeForm);
- yield takeLatest(CREATE_JOBTYPE_RECEIVE, clearJobtypeCreateForm);
-}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/jobtypelistSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/jobtypelistSaga.js
index fe7dbb52..5c917294 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/jobtypelistSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/jobtypelistSaga.js
@@ -11,10 +11,6 @@ export function* requestJobtypeListSaga() {
yield takeLatest(JOBTYPELIST_REQUEST, receiveJobtypeListSaga);
}
-function doJobtypeList() {
- return axios.get('/api/jobtypes');
-}
-
// worker saga
function* receiveJobtypeListSaga() {
try {
@@ -25,3 +21,7 @@ function* receiveJobtypeListSaga() {
yield put(JOBTYPELIST_FAILURE(error));
}
}
+
+function doJobtypeList() {
+ return axios.get('/api/jobtypes');
+}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/locationSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/locationSaga.js
index 4be291cc..1f015099 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/locationSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/locationSaga.js
@@ -17,6 +17,10 @@ import {
} from '../actiontypes';
import { findUsername } from '../common/login';
+export default function* locationSaga() {
+ yield takeLatest(LOCATION_CHANGE, locationChange);
+}
+
function* locationChange(action) {
const { location = {} } = action.payload || {};
const basename = yield select(state => state.router.basename);
@@ -97,10 +101,6 @@ function* locationChange(action) {
}
}
-export default function* locationSaga() {
- yield takeLatest(LOCATION_CHANGE, locationChange);
-}
-
function findPathname(location, basename) {
if (basename === '/') {
return location.pathname;
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/loginSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/loginSaga.js
index 92d59a46..c2059412 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/loginSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/loginSaga.js
@@ -15,16 +15,13 @@ import {
} from '../actiontypes';
import { emptyLoginResponse } from './constants';
-export function* requestInitialLoginStateSaga() {
+export default function* loginSaga() {
yield takeLatest(INITIAL_LOGIN_STATE_REQUEST, receiveInitialLoginStateSaga);
+ yield takeLatest(CHECK_LOGIN_STATE_REQUEST, receiveCheckLoginStateSaga);
+ yield takeLatest(LOGIN_REQUEST, receiveLoginSaga);
}
-function doGetLogin() {
- return axios.get('/api/login');
-}
-
-// worker saga
-export function* receiveInitialLoginStateSaga() {
+function* receiveInitialLoginStateSaga() {
try {
const response = yield call(doGetLogin);
const loginResponse = (response.headers['content-type'] == 'application/json') ? response.data : emptyLoginResponse;
@@ -39,12 +36,7 @@ export function* receiveInitialLoginStateSaga() {
}
}
-export function* requestCheckLoginStateSaga() {
- yield takeLatest(CHECK_LOGIN_STATE_REQUEST, receiveCheckLoginStateSaga);
-}
-
-// worker saga
-export function* receiveCheckLoginStateSaga() {
+function* receiveCheckLoginStateSaga() {
try {
const response = yield call(doGetLogin);
const loginResponse = (response.headers['content-type'] == 'application/json') ? response.data : emptyLoginResponse;
@@ -54,16 +46,10 @@ export function* receiveCheckLoginStateSaga() {
}
}
-// watcher saga
-export function* requestLoginSaga() {
- yield takeLatest(LOGIN_REQUEST, receiveLoginSaga);
-}
-
-function doLogin(username, password) {
- return axios.post('/api/login', { username, password });
+function doGetLogin() {
+ return axios.get('/api/login');
}
-// worker saga
function* receiveLoginSaga(action) {
try {
const payload = action.payload || {};
@@ -74,3 +60,7 @@ function* receiveLoginSaga(action) {
yield put(LOGIN_FAILURE(error));
}
}
+
+function doLogin(username, password) {
+ return axios.post('/api/login', { username, password });
+}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/logoutSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/logoutSaga.js
index 8926c850..c9909659 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/logoutSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/logoutSaga.js
@@ -8,8 +8,9 @@ import {
} from '../actiontypes';
import { emptyLoginResponse } from './constants';
-function doLogout() {
- return axios.post('/api/logout', {});
+export default function* logoutSaga() {
+ yield takeLatest(LOGOUT_REQUEST, receiveLogoutSaga);
+ yield takeLatest(LOGOUT_RECEIVE, reloadPage);
}
function* receiveLogoutSaga() {
@@ -22,13 +23,12 @@ function* receiveLogoutSaga() {
}
}
+function doLogout() {
+ return axios.post('/api/logout', {});
+}
+
function* reloadPage(action) {
if (!action.payload.username) {
yield put(RELOAD_WEB_PAGE());
}
}
-
-export default function* logoutSaga() {
- yield takeLatest(LOGOUT_REQUEST, receiveLogoutSaga);
- yield takeLatest(LOGOUT_RECEIVE, reloadPage);
-}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/modifyBonusSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/modifyBonusSaga.js
index e87b5249..95cdb7a2 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/modifyBonusSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/modifyBonusSaga.js
@@ -6,8 +6,8 @@ import {
MODIFY_BONUS_FAILURE,
} from '../actiontypes';
-function doModifyBonus(bonus) {
- return axios.post('/api/admin/modifybonus', bonus);
+export default function* modifyBonusSaga() {
+ yield takeLatest(MODIFY_BONUS_REQUEST, receiveModifyBonusSaga);
}
function* receiveModifyBonusSaga(action) {
@@ -20,6 +20,6 @@ function* receiveModifyBonusSaga(action) {
}
}
-export default function* modifyBonusSaga() {
- yield takeLatest(MODIFY_BONUS_REQUEST, receiveModifyBonusSaga);
+function doModifyBonus(bonus) {
+ return axios.post('/api/admin/modifybonus', bonus);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/modifyJobtypeSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/modifyJobtypeSaga.js
index ada1cc16..0fa7254b 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/modifyJobtypeSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/modifyJobtypeSaga.js
@@ -6,8 +6,8 @@ import {
MODIFY_JOBTYPE_FAILURE,
} from '../actiontypes';
-function doModifyJobtype(jobtype) {
- return axios.post('/api/admin/jobtype/modify', jobtype);
+export default function* modifyJobtypeSaga() {
+ yield takeLatest(MODIFY_JOBTYPE_REQUEST, receiveModifyJobtypeSaga);
}
function* receiveModifyJobtypeSaga(action) {
@@ -20,6 +20,6 @@ function* receiveModifyJobtypeSaga(action) {
}
}
-export default function* modifyJobtypeSaga() {
- yield takeLatest(MODIFY_JOBTYPE_REQUEST, receiveModifyJobtypeSaga);
+function doModifyJobtype(jobtype) {
+ return axios.post('/api/admin/jobtype/modify', jobtype);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/modifyPaymenttypeSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/modifyPaymenttypeSaga.js
index 0c616046..3ace0aa7 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/modifyPaymenttypeSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/modifyPaymenttypeSaga.js
@@ -6,8 +6,8 @@ import {
MODIFY_PAYMENTTYPE_FAILURE,
} from '../actiontypes';
-function doModifyPaymenttype(paymenttype) {
- return axios.post('/api/admin/paymenttype/modify', paymenttype);
+export default function* modifyPaymenttypeSaga() {
+ yield takeLatest(MODIFY_PAYMENTTYPE_REQUEST, requestReceiveModifyPaymenttypeSaga);
}
function* requestReceiveModifyPaymenttypeSaga(action) {
@@ -20,6 +20,6 @@ function* requestReceiveModifyPaymenttypeSaga(action) {
}
}
-export default function* modifyPaymenttypeSaga() {
- yield takeLatest(MODIFY_PAYMENTTYPE_REQUEST, requestReceiveModifyPaymenttypeSaga);
+function doModifyPaymenttype(paymenttype) {
+ return axios.post('/api/admin/paymenttype/modify', paymenttype);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/modifyUserSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/modifyUserSaga.js
index b4ec7053..01ef687a 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/modifyUserSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/modifyUserSaga.js
@@ -6,9 +6,8 @@ import {
CHANGE_USER_FAILURE,
} from '../actiontypes';
-
-function doModifyUser(user) {
- return axios.post('/api/admin/user/modify', user);
+export default function* modifyUserSaga() {
+ yield takeLatest(CHANGE_USER_REQUEST, requestReceiveModifyUserSaga);
}
function* requestReceiveModifyUserSaga(action) {
@@ -21,6 +20,6 @@ function* requestReceiveModifyUserSaga(action) {
}
}
-export default function* modifyUserSaga() {
- yield takeLatest(CHANGE_USER_REQUEST, requestReceiveModifyUserSaga);
+function doModifyUser(user) {
+ return axios.post('/api/admin/user/modify', user);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/passwordSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/passwordSaga.js
index 8bc40ef9..df6214f6 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/passwordSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/passwordSaga.js
@@ -5,6 +5,11 @@ import {
MODIFY_PASSWORDS_NOT_IDENTICAL,
} from '../actiontypes';
+export default function* passwordSaga() {
+ yield takeLatest(MODIFY_PASSWORD1, comparePasswords);
+ yield takeLatest(MODIFY_PASSWORD2, comparePasswords);
+}
+
function* comparePasswords() {
const password1 = yield select(state => state.password1);
const password2 = yield select(state => state.password2);
@@ -15,8 +20,3 @@ function* comparePasswords() {
yield put(MODIFY_PASSWORDS_NOT_IDENTICAL(password1 !== password2));
}
}
-
-export default function* passwordSaga() {
- yield takeLatest(MODIFY_PASSWORD1, comparePasswords);
- yield takeLatest(MODIFY_PASSWORD2, comparePasswords);
-}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/paymentSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/paymentSaga.js
index f2e6027f..d0e87fd2 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/paymentSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/paymentSaga.js
@@ -9,6 +9,12 @@ import {
CLEAR_PAYMENT_TYPE_FORM,
} from '../actiontypes';
+export default function* paymentSaga() {
+ yield takeLatest(SELECT_PAYMENT_TYPE, selectPaymentType);
+ yield takeLatest(SELECT_PAYMENT_TYPE_FOR_EDIT, selectPaymentTypeForEdit);
+ yield takeLatest(REGISTER_PAYMENT_BUTTON_CLICKED, buildRequestAndRegisterPayment);
+}
+
function* selectPaymentType(action) {
const transactionTypeId = parseInt(action.payload);
if (transactionTypeId === -1) {
@@ -48,9 +54,3 @@ function* buildRequestAndRegisterPayment() {
}));
yield put(REGISTERPAYMENT_REQUEST(payment));
}
-
-export default function* paymentSaga() {
- yield takeLatest(SELECT_PAYMENT_TYPE, selectPaymentType);
- yield takeLatest(SELECT_PAYMENT_TYPE_FOR_EDIT, selectPaymentTypeForEdit);
- yield takeLatest(REGISTER_PAYMENT_BUTTON_CLICKED, buildRequestAndRegisterPayment);
-}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/paymenttypeSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/paymenttypeSaga.js
index f2f6c158..ffc44e89 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/paymenttypeSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/paymenttypeSaga.js
@@ -13,6 +13,15 @@ import {
CLEAR_PAYMENT_TYPE_FORM,
} from '../actiontypes';
+export default function* paymentSaga() {
+ yield takeLatest(SELECT_PAYMENT_TYPE, selectPaymentType);
+ yield takeLatest(SELECT_PAYMENT_TYPE_FOR_EDIT, selectPaymentTypeForEdit);
+ yield takeLatest(SAVE_CHANGES_TO_PAYMENT_TYPE_BUTTON_CLICKED, buildRequestAndSaveModifiedPaymentType);
+ yield takeLatest(CREATE_PAYMENT_TYPE_BUTTON_CLICKED, buildRequestAndSaveCreatedPaymentType);
+ yield takeLatest(MODIFY_PAYMENTTYPE_RECEIVE, clearPaymenttypeForm);
+ yield takeLatest(CREATE_PAYMENTTYPE_RECEIVE, clearPaymenttypeForm);
+}
+
function* selectPaymentType(action) {
const transactionTypeId = parseInt(action.payload);
if (transactionTypeId === -1) {
@@ -61,12 +70,3 @@ function* buildRequestAndSaveCreatedPaymentType() {
function* clearPaymenttypeForm() {
yield put(CLEAR_PAYMENT_TYPE_FORM());
}
-
-export default function* paymentSaga() {
- yield takeLatest(SELECT_PAYMENT_TYPE, selectPaymentType);
- yield takeLatest(SELECT_PAYMENT_TYPE_FOR_EDIT, selectPaymentTypeForEdit);
- yield takeLatest(SAVE_CHANGES_TO_PAYMENT_TYPE_BUTTON_CLICKED, buildRequestAndSaveModifiedPaymentType);
- yield takeLatest(CREATE_PAYMENT_TYPE_BUTTON_CLICKED, buildRequestAndSaveCreatedPaymentType);
- yield takeLatest(MODIFY_PAYMENTTYPE_RECEIVE, clearPaymenttypeForm);
- yield takeLatest(CREATE_PAYMENTTYPE_RECEIVE, clearPaymenttypeForm);
-}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/paymenttypesSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/paymenttypesSaga.js
index 95fa691e..30949e52 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/paymenttypesSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/paymenttypesSaga.js
@@ -7,8 +7,8 @@ import {
SELECT_PAYMENT_TYPE,
} from '../actiontypes';
-function doPaymenttypes() {
- return axios.get('/api/paymenttypes');
+export default function* paymenttypesSaga() {
+ yield takeLatest(PAYMENTTYPES_REQUEST, receivePaymenttypesSaga);
}
function* receivePaymenttypesSaga() {
@@ -24,6 +24,6 @@ function* receivePaymenttypesSaga() {
}
}
-export default function* paymenttypesSaga() {
- yield takeLatest(PAYMENTTYPES_REQUEST, receivePaymenttypesSaga);
+function doPaymenttypes() {
+ return axios.get('/api/paymenttypes');
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/recentjobsSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/recentjobsSaga.js
index ca4890ea..d1f65646 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/recentjobsSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/recentjobsSaga.js
@@ -11,10 +11,6 @@ export function* requestRecentJobsSaga() {
yield takeLatest(RECENTJOBS_REQUEST, receiveRecentJobsSaga);
}
-function doRecentJobs(accountId) {
- return axios.get('/api/jobs/' + accountId);
-}
-
// worker saga
function* receiveRecentJobsSaga(action) {
try {
@@ -25,3 +21,7 @@ function* receiveRecentJobsSaga(action) {
yield put(RECENTJOBS_FAILURE(error));
}
}
+
+function doRecentJobs(accountId) {
+ return axios.get('/api/jobs/' + accountId);
+}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/recentpaymentsSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/recentpaymentsSaga.js
index 2aee27c9..1eb25bfb 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/recentpaymentsSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/recentpaymentsSaga.js
@@ -12,10 +12,6 @@ export function* requestRecentPaymentsSaga() {
yield takeLatest(RECENTPAYMENTS_REQUEST, receiveRecentPaymentsSaga);
}
-function doRecentPayments(accountId) {
- return axios.get('/api/payments/' + accountId);
-}
-
// worker saga
function* receiveRecentPaymentsSaga(action) {
try {
@@ -32,3 +28,7 @@ function* receiveRecentPaymentsSaga(action) {
yield put(RECENTPAYMENTS_FAILURE(error));
}
}
+
+function doRecentPayments(accountId) {
+ return axios.get('/api/payments/' + accountId);
+}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/registerJobSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/registerJobSaga.js
index 1ac219db..b9e30956 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/registerJobSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/registerJobSaga.js
@@ -7,8 +7,8 @@ import {
} from '../actiontypes';
import { emptyAccount } from '../constants';
-function doRegisterJob(performedJob) {
- return axios.post('/api/job/register', performedJob);
+export default function* registerJobSaga() {
+ yield takeLatest(REGISTERJOB_REQUEST, requestReceiveRegisterJobSaga);
}
function* requestReceiveRegisterJobSaga(action) {
@@ -21,6 +21,6 @@ function* requestReceiveRegisterJobSaga(action) {
}
}
-export default function* registerJobSaga() {
- yield takeLatest(REGISTERJOB_REQUEST, requestReceiveRegisterJobSaga);
+function doRegisterJob(performedJob) {
+ return axios.post('/api/job/register', performedJob);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/registerPaymentSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/registerPaymentSaga.js
index 9d6b1407..a662e2a6 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/registerPaymentSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/registerPaymentSaga.js
@@ -7,16 +7,8 @@ import {
} from '../actiontypes';
import { emptyAccount } from '../constants';
-function doRegisterPayment(payment) {
- return axios.post('/api/registerpayment', payment);
-}
-
-function doNotifyPaymentdone(payment, paymenttype) {
- const notification = {
- title: 'Ukelønn',
- message: payment.transactionAmount + ' kroner ' + paymenttype.transactionTypeName,
- };
- return axios.post('/api/notificationto/' + payment.account.username, notification);
+export default function* registerPaymentSaga() {
+ yield takeLatest(REGISTERPAYMENT_REQUEST, receiveRegisterPaymentSaga);
}
function* receiveRegisterPaymentSaga(action) {
@@ -33,6 +25,14 @@ function* receiveRegisterPaymentSaga(action) {
}
}
-export default function* registerPaymentSaga() {
- yield takeLatest(REGISTERPAYMENT_REQUEST, receiveRegisterPaymentSaga);
+function doRegisterPayment(payment) {
+ return axios.post('/api/registerpayment', payment);
+}
+
+function doNotifyPaymentdone(payment, paymenttype) {
+ const notification = {
+ title: 'Ukelønn',
+ message: payment.transactionAmount + ' kroner ' + paymenttype.transactionTypeName,
+ };
+ return axios.post('/api/notificationto/' + payment.account.username, notification);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/reloadSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/reloadSaga.js
index a6ce11da..fd13730c 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/reloadSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/reloadSaga.js
@@ -1,10 +1,10 @@
import { takeLatest } from 'redux-saga/effects';
import { RELOAD_WEB_PAGE } from '../actiontypes';
-function reloadWebPage() {
- location.reload();
-}
-
export default function* reloadSaga() {
yield takeLatest(RELOAD_WEB_PAGE, reloadWebPage);
}
+
+function reloadWebPage() {
+ location.reload();
+}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/updateJobSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/updateJobSaga.js
index 2d6cd52b..bd96e71d 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/updateJobSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/updateJobSaga.js
@@ -6,8 +6,8 @@ import {
UPDATE_JOB_FAILURE,
} from '../actiontypes';
-function doUpdateJob(updatedJob) {
- return axios.post('/api/job/update', updatedJob);
+export default function* updateJobSaga() {
+ yield takeLatest(UPDATE_JOB_REQUEST, requestReceiveUpdateJobSaga);
}
function* requestReceiveUpdateJobSaga(action) {
@@ -20,6 +20,6 @@ function* requestReceiveUpdateJobSaga(action) {
}
}
-export default function* updateJobSaga() {
- yield takeLatest(UPDATE_JOB_REQUEST, requestReceiveUpdateJobSaga);
+function doUpdateJob(updatedJob) {
+ return axios.post('/api/job/update', updatedJob);
}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/userSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/userSaga.js
index 6db1eb40..4e1d9604 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/userSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/userSaga.js
@@ -17,6 +17,17 @@ import {
CLEAR_USER_AND_PASSWORDS,
} from '../actiontypes';
+export default function* userSaga() {
+ yield takeLatest(SELECT_USER, queryAdminStatusForSelectedUser);
+ yield takeLatest(USERS_RECEIVE, clearUserForm);
+ yield takeLatest(SAVE_USER_BUTTON_CLICKED, collectAndSaveModifiedUser);
+ yield takeLatest(CHANGE_PASSWORD_BUTTON_CLICKED, collectDataAndSaveUpdatedPassword);
+ yield takeLatest(CREATE_USER_BUTTON_CLICKED, saveCreatedUser);
+ yield takeLatest(CHANGE_USER_RECEIVE, clearUserForm);
+ yield takeLatest(CHANGE_USER_PASSWORD_RECEIVE, clearUserAndPasswordForms);
+ yield takeLatest(CREATE_USER_RECEIVE, clearUserAndPasswordForms);
+}
+
function* queryAdminStatusForSelectedUser(action) {
if (action.payload.userid !== -1) {
yield put(REQUEST_ADMIN_STATUS(action.payload));
@@ -70,14 +81,3 @@ function* clearUserForm() {
function* clearUserAndPasswordForms() {
yield put(CLEAR_USER_AND_PASSWORDS());
}
-
-export default function* userSaga() {
- yield takeLatest(SELECT_USER, queryAdminStatusForSelectedUser);
- yield takeLatest(USERS_RECEIVE, clearUserForm);
- yield takeLatest(SAVE_USER_BUTTON_CLICKED, collectAndSaveModifiedUser);
- yield takeLatest(CHANGE_PASSWORD_BUTTON_CLICKED, collectDataAndSaveUpdatedPassword);
- yield takeLatest(CREATE_USER_BUTTON_CLICKED, saveCreatedUser);
- yield takeLatest(CHANGE_USER_RECEIVE, clearUserForm);
- yield takeLatest(CHANGE_USER_PASSWORD_RECEIVE, clearUserAndPasswordForms);
- yield takeLatest(CREATE_USER_RECEIVE, clearUserAndPasswordForms);
-}
diff --git a/ukelonn.web.frontend/src/main/frontend/sagas/usersSaga.js b/ukelonn.web.frontend/src/main/frontend/sagas/usersSaga.js
index fb7e4cf6..ee222252 100644
--- a/ukelonn.web.frontend/src/main/frontend/sagas/usersSaga.js
+++ b/ukelonn.web.frontend/src/main/frontend/sagas/usersSaga.js
@@ -6,8 +6,8 @@ import {
USERS_FAILURE,
} from '../actiontypes';
-function doUsers() {
- return axios.get('/api/users');
+export default function* usersSaga() {
+ yield takeLatest(USERS_REQUEST, receiveUsersSaga);
}
function* receiveUsersSaga() {
@@ -20,6 +20,6 @@ function* receiveUsersSaga() {
}
}
-export default function* usersSaga() {
- yield takeLatest(USERS_REQUEST, receiveUsersSaga);
+function doUsers() {
+ return axios.get('/api/users');
}