| 
					
				 | 
			
			
				@@ -1,6 +1,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** @module swisstennis/state */
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { call, put, takeEvery } from 'redux-saga/effects'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { SZTM_API } from '../config/static'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { SZTM_API } from '../local-constants'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /**
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * state.js
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -27,43 +27,28 @@ export const actions = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       error
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  loginRequest: () => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  loginRequest: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/LOGIN_REQUEST'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  loginSuccess: (key) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/LOGIN_SUCCESS',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      key
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  loginFailure: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/LOGIN_FAILURE',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/LOGIN_REQUEST',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       data
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  getPlayerListRequest: () => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  loginSuccess: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/GET_PLAYERLIST_REQUEST'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  getPlayerListSuccess: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/GET_PLAYERLIST_SUCCESS',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/LOGIN_SUCCESS',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       data
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  getPlayerListFailure: error => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  loginFailure: (error) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/GET_PLAYERLIST_FAILURE',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/LOGIN_FAILURE',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       error
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  downloadPlayerListRequest: () => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  downloadPlayerListRequest: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/DOWNLOAD_PLAYERLIST_REQUEST'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/DOWNLOAD_PLAYERLIST_REQUEST',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      data
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   downloadPlayerListSuccess: (data) => {
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -78,21 +63,21 @@ export const actions = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       error
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  getCalendarRequest: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  parsePlayerListRequest: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/GET_CALENDAR_REQUEST',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/PARSE_PLAYERLIST_REQUEST',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       data
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  getCalendarSuccess: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  parsePlayerListSuccess: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/GET_CALENDAR_SUCCESS',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/PARSE_PLAYERLIST_SUCCESS',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       data
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  getCalendarFailure: error => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  parsePlayerListFailure: error => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/GET_CALENDAR_FAILURE',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/PARSE_PLAYERLIST_FAILURE',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       error
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -114,39 +99,56 @@ export const actions = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       error
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  parsePlayerListRequest: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  parseCalendarRequest: data => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/PARSE_PLAYERLIST_REQUEST',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/PARSE_CALENDAR_REQUEST',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       data
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  parsePlayerListSuccess: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  parseCalendarSuccess: data => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/PARSE_PLAYERLIST_SUCCESS',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/PARSE_CALENDAR_SUCCESS',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       data
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  parsePlayerListFailure: error => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  parseCalendarFailure: error => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/PARSE_PLAYERLIST_FAILURE',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/PARSE_CALENDAR_FAILURE',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       error
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  parseCalendarRequest: (key) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  getPlayerListRequest: () => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/PARSE_CALENDAR_REQUEST',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      key
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/GET_PLAYERLIST_REQUEST'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  parseCalendarSuccess: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  getPlayerListSuccess: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/PARSE_CALENDAR_SUCCESS',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/GET_PLAYERLIST_SUCCESS',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       data
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  parseCalendarFailure: error => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  getPlayerListFailure: error => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      type: 'SWISSTENNIS/PARSE_CALENDAR_FAILURE',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/GET_PLAYERLIST_FAILURE',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      error
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  getCalendarRequest: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/GET_CALENDAR_REQUEST',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      data
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  getCalendarSuccess: (data) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/GET_CALENDAR_SUCCESS',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      data
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  getCalendarFailure: error => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'SWISSTENNIS/GET_CALENDAR_FAILURE',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       error
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   },
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -161,8 +163,11 @@ export const state = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   calendarsStatus: 'uninitialized',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   playerLists: [],
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   playerListsStatus: 'uninitialized',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  transferStarted: false,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  loginState: false,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  playerListDownloadStatus: 'uninitialized',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  playerListParseStatus: 'uninitialized',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  calendarDownloadStatus: 'uninitialized',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  calendarParseStatus: 'uninitialized',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  loginStatus: 'uninitialized',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 console.log('State state', state)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -170,11 +175,47 @@ console.log('State state', state) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export function reducer (state = [], action) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   switch (action.type) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     case 'SWISSTENNIS/FILE_LIST_REQUEST':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      return { ...state, fileListStatus: 'loading' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, fileListStatus: 'request' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     case 'SWISSTENNIS/FILE_LIST_SUCCESS':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      return { ...state, fileListStatus: 'loaded', files: action.data }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, fileListStatus: 'success', files: action.data }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     case 'SWISSTENNIS/FILE_LIST_FAILURE':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      return { ...state, fileListStatus: 'failed' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, fileListStatus: 'failure' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/LOGIN_REQUEST':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        loginStatus: 'request', 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        playerListDownloadStatus: action.data.sequence ? 'uninitialized' : state.playerListDownloadStatus,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        playerListParseStatus: action.data.sequence ? 'uninitialized' : state.playerListParseStatus,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        calendarDownloadStatus: action.data.sequence ? 'uninitialized' : state.calendarDownloadStatus,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        calendarParseStatus: action.data.sequence ? 'uninitialized' : state.calendarParseStatus,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/LOGIN_SUCCESS':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, loginStatus: 'success' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/LOGIN_FAILURE':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, loginStatus: 'failure' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/DOWNLOAD_PLAYERLIST_REQUEST':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, playerListDownloadStatus: 'request' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/DOWNLOAD_PLAYERLIST_SUCCESS':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, playerListDownloadStatus: 'success', files: [ ...state.files, action.data ] }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/DOWNLOAD_PLAYERLIST_FAILURE':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, playerListDownloadStatus: 'failure' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/PARSE_PLAYERLIST_REQUEST':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, playerListParseStatus: 'request' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/PARSE_PLAYERLIST_SUCCESS':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, playerListParseStatus: 'success', playerLists: [ ...state.playerLists, action.data.playerList ] }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/PARSE_PLAYERLIST_FAILURE':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, playerListParseStatus: 'failure' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/DOWNLOAD_CALENDAR_REQUEST':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, calendarDownloadStatus: 'request' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/DOWNLOAD_CALENDAR_SUCCESS':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, calendarDownloadStatus: 'success', files: [ ...state.files, action.data ] }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/DOWNLOAD_CALENDAR_FAILURE':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, calendarDownloadStatus: 'failure' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/PARSE_CALENDAR_REQUEST':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, calendarParseStatus: 'request' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/PARSE_CALENDAR_SUCCESS':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, calendarParseStatus: 'success', calendars: [ ...state.calendars, action.data.matchList ] }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    case 'SWISSTENNIS/PARSE_CALENDAR_FAILURE':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return { ...state, calendarParseStatus: 'failure' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     case 'SWISSTENNIS/GET_CALENDAR_REQUEST':
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return { ...state, calendarsStatus: 'loading' }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     case 'SWISSTENNIS/GET_CALENDAR_SUCCESS':
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -219,9 +260,9 @@ function * fileList (action) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 function * login (action) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   try {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const token = localStorage.getItem('accessToken')
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log('Get config requested', action, token)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    const response = yield call(fetch, `${SZTM_API}/api/config`, {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      method: 'GET',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('Swisstennis login requested', action, token)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const response = yield call(fetch, `${SZTM_API}/api/swisstennis/login`, {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      method: 'POST',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       headers: {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         'Content-Type': 'application/json',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         'x-access-token': token
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -232,11 +273,12 @@ function * login (action) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       throw Error(response.status)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const responseJson = yield response.json()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      yield put(actions.configGetSuccess(responseJson))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      yield put(actions.loginSuccess(responseJson))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (action.data.sequence) yield put(actions.downloadPlayerListRequest({sequence: true}))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } catch (error) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log('Config failure!', actions.configAddFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    yield put(actions.configAddFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('Config failure!', actions.loginFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    yield put(actions.loginFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -263,11 +305,58 @@ function * getCalendars (action) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+function * downloadCalendar (action) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  try {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const token = localStorage.getItem('accessToken')
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('Download calendar requested', action, token)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const response = yield call(fetch, `${SZTM_API}/api/swisstennis/calendar/download`, {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      method: 'GET',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      headers: {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        'Content-Type': 'application/json',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        'x-access-token': token
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }) 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (response.status != 200) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      throw Error(response.status)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const responseJson = yield response.json()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      yield put(actions.downloadCalendarSuccess(responseJson))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (action.data.sequence) yield put(actions.parseCalendarRequest({filename: responseJson.filename, sequence: true}))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } catch (error) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('Config failure!', actions.downloadCalendarFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    yield put(actions.downloadCalendarFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+function * parseCalendar (action) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  try {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const token = localStorage.getItem('accessToken')
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('Download calendar requested', action, token)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const response = yield call(fetch, `${SZTM_API}/api/swisstennis/calendar/parse/${action.data.filename}`, {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      method: 'GET',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      headers: {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        'Content-Type': 'application/json',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        'x-access-token': token
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }) 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (response.status != 200) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      throw Error(response.status)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const responseJson = yield response.json()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      yield put(actions.parseCalendarSuccess(responseJson))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } catch (error) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('Config failure!', actions.parseCalendarFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    yield put(actions.parseCalendarFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 function * getPlayerLists (action) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   try {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const token = localStorage.getItem('accessToken')
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     console.log('Get config requested', action, token)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    const response = yield call(fetch, `${SZTM_API}/api/swisstennis/playerList`, {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const response = yield call(fetch, `${SZTM_API}/api/swisstennis/playerlist`, {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       method: 'GET',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       headers: {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         'Content-Type': 'application/json',
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -286,50 +375,49 @@ function * getPlayerLists (action) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-function * addConfig (action) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+function * downloadPlayerList (action) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   try {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const token = localStorage.getItem('accessToken')
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log('Add config requested', action, token)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    const response = yield call(fetch, `${SZTM_API}/api/config`, {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      method: 'POST',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('Playerlist download requested', action, token)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const response = yield call(fetch, `${SZTM_API}/api/swisstennis/playerlist/download`, {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      method: 'GET',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       headers: {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        'Content-Type': 'application/json',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         'x-access-token': token
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      body: JSON.stringify(action.data)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }) 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (response.status != 200) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       throw Error(response.status)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      yield put(actions.configAddSuccess(action.data))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      yield put(actions.configGetRequest())
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const responseJson = yield response.json()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      yield put(actions.downloadPlayerListSuccess(responseJson))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (action.data.sequence) yield put(actions.parsePlayerListRequest({filename: responseJson.filename, sequence: true}))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } catch (error) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log('Config failure!', actions.configAddFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    yield put(actions.configAddFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('Config failure!', actions.downloadPlayerListFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    yield put(actions.downloadPlayerListFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-function * editConfig (action) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+function * parsePlayerList (action) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   try {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const token = localStorage.getItem('accessToken')
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log('Edit config requested', action, token)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    const response = yield call(fetch, `${SZTM_API}/api/config`, {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      method: 'PUT',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('PlayerList parse requested', action, token)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const response = yield call(fetch, `${SZTM_API}/api/swisstennis/playerlist/parse/${action.data.filename}`, {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      method: 'GET',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       headers: {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        'Content-Type': 'application/json',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         'x-access-token': token
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      body: JSON.stringify(action.data)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    }) 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    })
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (response.status != 200) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       throw Error(response.status)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      yield put(actions.configEditSuccess(action.data))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const responseJson = yield response.json()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      yield put(actions.parsePlayerListSuccess(responseJson))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (action.data.sequence) yield put(actions.downloadCalendarRequest({sequence: true}))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } catch (error) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log('Config failure!', actions.configEditFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    yield put(actions.configEditFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('Config failure!', actions.parsePlayerListFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    yield put(actions.parsePlayerListFailure(error))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -337,6 +425,10 @@ function * editConfig (action) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export function * saga () {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   console.log('Config saga started.')
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   yield takeEvery('SWISSTENNIS/FILE_LIST_REQUEST', fileList)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  yield takeEvery('SWISSTENNIS/DOWNLOAD_PLAYERLIST_REQUEST', downloadPlayerList)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  yield takeEvery('SWISSTENNIS/PARSE_PLAYERLIST_REQUEST', parsePlayerList)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  yield takeEvery('SWISSTENNIS/DOWNLOAD_CALENDAR_REQUEST', downloadCalendar)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  yield takeEvery('SWISSTENNIS/PARSE_CALENDAR_REQUEST', parseCalendar)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   yield takeEvery('SWISSTENNIS/GET_CALENDAR_REQUEST', getCalendars)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   yield takeEvery('SWISSTENNIS/GET_PLAYERLIST_REQUEST', getPlayerLists)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   yield takeEvery('SWISSTENNIS/LOGIN_REQUEST', login)
 
			 |