@olea-bps/base 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/AppBar/index.js +84 -0
- package/components/AppBar/styles.js +27 -0
- package/components/BookDetail/index.js +268 -0
- package/components/BookDetail/styles.js +124 -0
- package/components/ComponentJobsFilter/index.js +188 -0
- package/components/ComponentJobsFilter/styles.js +12 -0
- package/components/ConnectivityWarning/index.js +65 -0
- package/components/ConnectivityWarning/styles.js +19 -0
- package/components/ContactDetail/index.js +232 -0
- package/components/ContactDetail/styles.js +32 -0
- package/components/CourseDetail/index.js +357 -0
- package/components/CourseDetail/styles.js +59 -0
- package/components/CourseDetailDialog/index.js +169 -0
- package/components/CourseDetailDialog/styles.js +116 -0
- package/components/CourseInfo/index.js +219 -0
- package/components/CourseInfo/styles.js +40 -0
- package/components/DevelopmentDialog/index.js +214 -0
- package/components/DevelopmentDialog/styles.js +10 -0
- package/components/EventCodeInput/index.js +149 -0
- package/components/EventCodeInput/styles.js +108 -0
- package/components/FlexMenuEntry/index.js +84 -0
- package/components/FlexMenuEntry/styles.js +27 -0
- package/components/MainMenuEntry/index.js +88 -0
- package/components/MainMenuEntry/styles.js +28 -0
- package/components/MealItem/index.js +87 -0
- package/components/MealItem/styles.js +84 -0
- package/components/MensaMenu/index.js +305 -0
- package/components/MensaMenu/styles.js +94 -0
- package/components/MensaSlider/index.js +188 -0
- package/components/MensaSlider/styles.js +53 -0
- package/components/Modal/index.js +106 -0
- package/components/Modal/styles.js +8 -0
- package/components/NewsDetail/index.js +377 -0
- package/components/NewsDetail/styles.js +77 -0
- package/components/NewsList/index.js +120 -0
- package/components/NewsList/styles.js +19 -0
- package/components/NewsListItem/index.js +89 -0
- package/components/NewsListItem/styles.js +32 -0
- package/components/OtherCourses/index.js +152 -0
- package/components/OtherCourses/styles.js +10 -0
- package/components/PtsDeparture/index.js +140 -0
- package/components/PtsDeparture/styles.js +7 -0
- package/components/PtsStation/index.js +186 -0
- package/components/PtsStation/styles.js +47 -0
- package/components/QuickLinks/index.js +127 -0
- package/components/QuickLinks/styles.js +45 -0
- package/components/RoomDetail/index.js +281 -0
- package/components/RoomDetail/styles.js +56 -0
- package/components/ScaledImage/index.js +92 -0
- package/components/SearchResults/index.js +362 -0
- package/components/SearchResults/styles.js +59 -0
- package/components/SettingSection/index.js +54 -0
- package/components/SettingSection/styles.js +15 -0
- package/components/SettingsDialog/index.js +52 -0
- package/components/SettingsDialog/styles.js +12 -0
- package/components/SettingsDialogRadio/index.js +66 -0
- package/components/SettingsDialogRadio/styles.js +7 -0
- package/components/SettingsDialogSelect/index.js +73 -0
- package/components/SettingsDialogSelect/styles.js +7 -0
- package/components/TimetableCodeInput/index.js +205 -0
- package/components/TimetableCodeInput/styles.js +28 -0
- package/components/TimetableDay/index.js +252 -0
- package/components/TimetableDay/styles.js +103 -0
- package/components/TimetableEvent/index.js +163 -0
- package/components/TimetableEvent/styles.js +108 -0
- package/components/TimetableList/index.js +180 -0
- package/components/TimetableList/styles.js +106 -0
- package/components/TimetableMonth/index.js +156 -0
- package/components/TimetableMonth/styles.js +29 -0
- package/components/TimetableWeek/index.js +230 -0
- package/components/TimetableWeek/styles.js +58 -0
- package/components/TopNews/index.js +282 -0
- package/components/TopNews/styles.js +125 -0
- package/components/TopNewsHtwk/index.js +279 -0
- package/components/TopNewsHtwk/styles.js +142 -0
- package/components/WebView/index.js +108 -0
- package/components/WebView/styles.js +11 -0
- package/context/context-callmanager/TucCallManager.js +74 -0
- package/context/context-callmanager/index.js +128 -0
- package/context/context-canteen/AsistServerApiProvider.js +126 -0
- package/context/context-canteen/CollektorVersion2ApiProvider.js +100 -0
- package/context/context-canteen/index.js +692 -0
- package/context/context-connectivity/index.js +85 -0
- package/context/context-event/AsistServerClient.js +82 -0
- package/context/context-event/index.js +205 -0
- package/context/context-flex-menu/AsistServerApiProvider.js +0 -0
- package/context/context-flex-menu/CollectorVersion2ApiProvider.js +32 -0
- package/context/context-flex-menu/index.js +160 -0
- package/context/context-info-dialog/CollektorVersion2ApiProvider.js +53 -0
- package/context/context-info-dialog/ProviderErrors.js +22 -0
- package/context/context-info-dialog/index.js +190 -0
- package/context/context-mails/MailService.js +147 -0
- package/context/context-mails/TucUnseenApiProvider.js +65 -0
- package/context/context-mails/index.js +131 -0
- package/context/context-news/CollektorVersion2ApiProvider.js +68 -0
- package/context/context-news/index.js +155 -0
- package/context/context-public-transport-ticket/CollektorVersion2ApiProvider.js +45 -0
- package/context/context-public-transport-ticket/ProviderErrors.js +11 -0
- package/context/context-public-transport-ticket/index.js +175 -0
- package/context/context-timetable/CollectorVersion2ApiProvider.js +102 -0
- package/context/context-timetable/ProviderErrors.js +22 -0
- package/context/context-timetable/TimetableService.js +357 -0
- package/context/context-timetable/index.js +215 -0
- package/context/context-user/index.js +586 -0
- package/index.js +178 -0
- package/libraries/base-api-provider/hooks.js +24 -0
- package/libraries/base-api-provider/http-api-provider.js +168 -0
- package/libraries/base-api-provider/index.js +20 -0
- package/libraries/core/api/canteens.js +88 -0
- package/libraries/core/api/corona.js +45 -0
- package/libraries/core/api/courses.js +54 -0
- package/libraries/core/api/device.js +98 -0
- package/libraries/core/api/feed.js +144 -0
- package/libraries/core/api/feedback.js +123 -0
- package/libraries/core/api/jobs.js +48 -0
- package/libraries/core/api/library.js +67 -0
- package/libraries/core/api/lostfound.js +77 -0
- package/libraries/core/api/occupancy.js +44 -0
- package/libraries/core/api/officehours.js +25 -0
- package/libraries/core/api/poi.js +25 -0
- package/libraries/core/api/pts.js +68 -0
- package/libraries/core/api/rooms.js +31 -0
- package/libraries/core/api/survey.js +121 -0
- package/libraries/core/api/telephone.js +32 -0
- package/libraries/core/api/tucrooms.js +31 -0
- package/libraries/core/constants/actions.js +75 -0
- package/libraries/core/constants/api.js +146 -0
- package/libraries/core/constants/enums.js +5 -0
- package/libraries/core/helper/date.js +9 -0
- package/libraries/core/helper/format.helper.js +2 -0
- package/libraries/core/index.js +60 -0
- package/libraries/core/redux/actions/notifications.js +6 -0
- package/libraries/core/redux/actions/setting.js +75 -0
- package/libraries/core/redux/actions/state.js +74 -0
- package/libraries/core/redux/asyncDispatch.js +27 -0
- package/libraries/core/redux/reducers/api.js +190 -0
- package/libraries/core/redux/reducers/index.js +32 -0
- package/libraries/core/redux/reducers/notifications.js +16 -0
- package/libraries/core/redux/reducers/setting.js +99 -0
- package/libraries/core/redux/reducers/state.js +122 -0
- package/libraries/core/redux/selectors.js +123 -0
- package/libraries/core/redux/store.js +40 -0
- package/libraries/core/services/data.js +96 -0
- package/libraries/core/services/root-navigation.js +36 -0
- package/libraries/core/services/search.js +175 -0
- package/libraries/core-plugins/enums/replaceTypes.js +53 -0
- package/libraries/core-plugins/index.js +21 -0
- package/libraries/core-plugins/redux/actions/plugin.js +13 -0
- package/libraries/core-plugins/redux/reducers/plugin.js +210 -0
- package/libraries/icons-openasist/index.js +143 -0
- package/libraries/notifications/index.js +268 -0
- package/libraries/notifications/services/subscriber.service.js +123 -0
- package/libraries/react-native-webview-autoheight/README.md +47 -0
- package/libraries/react-native-webview-autoheight/index.js +140 -0
- package/libraries/react-native-webview-autoheight/package.json +37 -0
- package/libraries/react-native-webview-autoheight/utils.js +268 -0
- package/libraries/redux-offline/.eslintignore +1 -0
- package/libraries/redux-offline/.github/ISSUE_TEMPLATE/redux-offline-core-issues-template.md +25 -0
- package/libraries/redux-offline/.prettierrc +6 -0
- package/libraries/redux-offline/LICENSE +21 -0
- package/libraries/redux-offline/README.md +133 -0
- package/libraries/redux-offline/flow-typed/npm/redux-logger_vx.x.x.js +109 -0
- package/libraries/redux-offline/flow-typed/npm/redux_v4.x.x.js +100 -0
- package/libraries/redux-offline/lib/actions.js +46 -0
- package/libraries/redux-offline/lib/config.js +15 -0
- package/libraries/redux-offline/lib/constants.js +17 -0
- package/libraries/redux-offline/lib/defaults/defaultCommit.js +11 -0
- package/libraries/redux-offline/lib/defaults/defaultRollback.js +11 -0
- package/libraries/redux-offline/lib/defaults/detectNetwork.js +33 -0
- package/libraries/redux-offline/lib/defaults/detectNetwork.native.js +211 -0
- package/libraries/redux-offline/lib/defaults/discard.js +18 -0
- package/libraries/redux-offline/lib/defaults/effect.js +87 -0
- package/libraries/redux-offline/lib/defaults/index.js +32 -0
- package/libraries/redux-offline/lib/defaults/offlineStateLens.js +24 -0
- package/libraries/redux-offline/lib/defaults/persist.js +9 -0
- package/libraries/redux-offline/lib/defaults/persist.native.js +17 -0
- package/libraries/redux-offline/lib/defaults/persistAutoRehydrate.js +8 -0
- package/libraries/redux-offline/lib/defaults/queue.js +27 -0
- package/libraries/redux-offline/lib/defaults/retry.js +29 -0
- package/libraries/redux-offline/lib/index.js +115 -0
- package/libraries/redux-offline/lib/middleware.js +56 -0
- package/libraries/redux-offline/lib/offlineActionTracker.js +43 -0
- package/libraries/redux-offline/lib/send.js +112 -0
- package/libraries/redux-offline/lib/types.js +3 -0
- package/libraries/redux-offline/lib/updater.js +111 -0
- package/libraries/redux-offline/package.json +69 -0
- package/libraries/redux-offline/src/__tests__/defaults/discard.js +22 -0
- package/libraries/redux-offline/src/__tests__/defaults/effect.js +118 -0
- package/libraries/redux-offline/src/__tests__/index.js +116 -0
- package/libraries/redux-offline/src/__tests__/middleware.js +185 -0
- package/libraries/redux-offline/src/__tests__/offlineActionTracker.js +54 -0
- package/libraries/redux-offline/src/__tests__/send.js +208 -0
- package/libraries/redux-offline/src/actions.js +36 -0
- package/libraries/redux-offline/src/config.js +9 -0
- package/libraries/redux-offline/src/constants.js +18 -0
- package/libraries/redux-offline/src/defaults/defaultCommit.js +7 -0
- package/libraries/redux-offline/src/defaults/defaultRollback.js +7 -0
- package/libraries/redux-offline/src/defaults/detectNetwork.js +16 -0
- package/libraries/redux-offline/src/defaults/detectNetwork.native.js +148 -0
- package/libraries/redux-offline/src/defaults/discard.js +19 -0
- package/libraries/redux-offline/src/defaults/effect.js +86 -0
- package/libraries/redux-offline/src/defaults/index.js +25 -0
- package/libraries/redux-offline/src/defaults/offlineStateLens.js +11 -0
- package/libraries/redux-offline/src/defaults/persist.js +4 -0
- package/libraries/redux-offline/src/defaults/persist.native.js +9 -0
- package/libraries/redux-offline/src/defaults/persistAutoRehydrate.js +4 -0
- package/libraries/redux-offline/src/defaults/queue.js +20 -0
- package/libraries/redux-offline/src/defaults/retry.js +18 -0
- package/libraries/redux-offline/src/index.js +138 -0
- package/libraries/redux-offline/src/middleware.js +52 -0
- package/libraries/redux-offline/src/offlineActionTracker.js +40 -0
- package/libraries/redux-offline/src/send.js +111 -0
- package/libraries/redux-offline/src/types.js +127 -0
- package/libraries/redux-offline/src/updater.js +141 -0
- package/libraries/redux-offline/typings.d.ts +150 -0
- package/libraries/redux-offline/yarn.lock +6460 -0
- package/libraries/stored-state/index.js +155 -0
- package/package.json +68 -0
- package/views/Callmanager/index.js +148 -0
- package/views/Callmanager/styles.js +62 -0
- package/views/Canteens/index.js +383 -0
- package/views/Canteens/styles.js +89 -0
- package/views/Dashboard/index.js +176 -0
- package/views/Dashboard/styles.js +16 -0
- package/views/DashboardHtwk/index.js +197 -0
- package/views/DashboardHtwk/styles.js +24 -0
- package/views/Event/index.js +373 -0
- package/views/Event/styles.js +63 -0
- package/views/FeedList/index.js +165 -0
- package/views/FeedList/styles.js +15 -0
- package/views/FeedNews/index.js +243 -0
- package/views/FeedNews/styles.js +32 -0
- package/views/Flexmenu/index.js +185 -0
- package/views/Flexmenu/styles.js +62 -0
- package/views/FlexmenuWebview/index.js +167 -0
- package/views/FlexmenuWebview/styles.js +16 -0
- package/views/Howhy/index.js +151 -0
- package/views/Howhy/styles.js +11 -0
- package/views/Jobs/index.js +217 -0
- package/views/Jobs/styles.js +41 -0
- package/views/MainMenu/index.js +283 -0
- package/views/MainMenu/styles.js +36 -0
- package/views/NewsTabbar/index.js +164 -0
- package/views/NewsTabbar/styles.js +27 -0
- package/views/Opal/index.js +136 -0
- package/views/Opal/styles.js +11 -0
- package/views/PublicTransportTicket/index.js +173 -0
- package/views/PublicTransportTicket/styles.js +17 -0
- package/views/Search/index.js +186 -0
- package/views/Search/styles.js +67 -0
- package/views/SettingsAccessibility/index.js +148 -0
- package/views/SettingsAccessibility/styles.js +13 -0
- package/views/SettingsAppInfo/index.js +86 -0
- package/views/SettingsAppInfo/styles.js +18 -0
- package/views/SettingsCanteens/index.js +249 -0
- package/views/SettingsCanteens/styles.js +33 -0
- package/views/SettingsGeneral/index.js +173 -0
- package/views/SettingsGeneral/styles.js +28 -0
- package/views/SettingsNotifications/index.js +204 -0
- package/views/SettingsNotifications/styles.js +38 -0
- package/views/SettingsUser/index.js +170 -0
- package/views/SettingsUser/styles.js +17 -0
- package/views/TimetableCalendar/index.js +387 -0
- package/views/TimetableCalendar/styles.js +121 -0
- package/views/TimetableList/index.js +402 -0
- package/views/TimetableList/styles.js +55 -0
- package/views/Webviews/index.js +158 -0
- package/views/Webviews/styles.js +11 -0
package/index.js
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
|
|
2
|
+
// Exports Components
|
|
3
|
+
|
|
4
|
+
export { default as AppBar } from './components/AppBar';
|
|
5
|
+
export { default as BookDetail } from './components/BookDetail';
|
|
6
|
+
export { default as ConnectivityWarning } from './components/ConnectivityWarning';
|
|
7
|
+
export { default as ContactDetail } from './components/ContactDetail';
|
|
8
|
+
export { default as CourseDetail } from './components/CourseDetail';
|
|
9
|
+
export { default as CourseDetailDialog } from './components/CourseDetailDialog';
|
|
10
|
+
export { default as CourseInfo } from './components/CourseInfo';
|
|
11
|
+
export { default as DevelopmentDialog } from './components/DevelopmentDialog';
|
|
12
|
+
export { default as EventCodeInput } from './components/EventCodeInput';
|
|
13
|
+
export { default as FlexMenuEntry } from './components/FlexMenuEntry';
|
|
14
|
+
export { default as MainMenuEntry } from './components/MainMenuEntry';
|
|
15
|
+
export { default as MealItem } from './components/MealItem';
|
|
16
|
+
export { default as MensaMenu } from './components/MensaMenu';
|
|
17
|
+
export { default as MensaSlider } from './components/MensaSlider';
|
|
18
|
+
export { default as Modal } from './components/Modal';
|
|
19
|
+
export { default as NewsDetail } from './components/NewsDetail';
|
|
20
|
+
export { default as NewsList } from './components/NewsList';
|
|
21
|
+
export { default as NewsListItem } from './components/NewsListItem';
|
|
22
|
+
export { default as OtherCourses } from './components/OtherCourses';
|
|
23
|
+
export { default as PtsDeparture } from './components/PtsDeparture';
|
|
24
|
+
export { default as PtsStation } from './components/PtsStation';
|
|
25
|
+
export { default as QuickLinks } from './components/QuickLinks';
|
|
26
|
+
export { default as RoomDetail } from './components/RoomDetail';
|
|
27
|
+
export { default as ScaledImage } from './components/ScaledImage';
|
|
28
|
+
export { default as SearchResults } from './components/SearchResults';
|
|
29
|
+
export { default as SettingSection } from './components/SettingSection';
|
|
30
|
+
export { default as SettingsDialog } from './components/SettingsDialog';
|
|
31
|
+
export { default as SettingsDialogRadio } from './components/SettingsDialogRadio';
|
|
32
|
+
export { default as SettingsDialogSelect } from './components/SettingsDialogSelect';
|
|
33
|
+
export { default as TimetableCodeInput } from './components/TimetableCodeInput';
|
|
34
|
+
export { default as TimetableDay } from './components/TimetableDay';
|
|
35
|
+
export { default as TimetableEvent } from './components/TimetableEvent';
|
|
36
|
+
export { default as TimetableListComponent } from './components/TimetableList';
|
|
37
|
+
export { default as TimetableMonth } from './components/TimetableMonth';
|
|
38
|
+
export { default as TimetableWeek } from './components/TimetableWeek';
|
|
39
|
+
export { default as TopNews } from './components/TopNews';
|
|
40
|
+
export { default as TopNewsHtwk } from './components/TopNewsHtwk';
|
|
41
|
+
export { default as WebView } from './components/WebView';
|
|
42
|
+
export { default as ComponentJobsFilter } from './components/ComponentJobsFilter';
|
|
43
|
+
|
|
44
|
+
// Exports Views
|
|
45
|
+
|
|
46
|
+
export { default as Callmanager } from './views/Callmanager';
|
|
47
|
+
export { default as Canteens } from './views/Canteens';
|
|
48
|
+
export { default as Dashboard } from './views/Dashboard';
|
|
49
|
+
export { default as DashboardHtwk } from './views/DashboardHtwk';
|
|
50
|
+
export { default as Event } from './views/Event';
|
|
51
|
+
export { default as FeedList } from './views/FeedList';
|
|
52
|
+
export { default as FeedNews } from './views/FeedNews';
|
|
53
|
+
export { default as Flexmenu } from './views/Flexmenu';
|
|
54
|
+
export { default as FlexmenuWebview } from './views/FlexmenuWebview';
|
|
55
|
+
export { default as Howhy } from './views/Howhy';
|
|
56
|
+
export { default as Jobs } from './views/Jobs';
|
|
57
|
+
export { default as MainMenu } from './views/MainMenu';
|
|
58
|
+
export { default as NewsTabbar } from './views/NewsTabbar';
|
|
59
|
+
export { default as Opal } from './views/Opal';
|
|
60
|
+
export { default as PublicTransportTicket } from './views/PublicTransportTicket';
|
|
61
|
+
export { default as Search } from './views/Search';
|
|
62
|
+
export { default as SettingsAccessibility } from './views/SettingsAccessibility';
|
|
63
|
+
export { default as SettingsAppInfo } from './views/SettingsAppInfo';
|
|
64
|
+
export { default as SettingsCanteens } from './views/SettingsCanteens';
|
|
65
|
+
export { default as SettingsGeneral } from './views/SettingsGeneral';
|
|
66
|
+
export { default as SettingsNotifications } from './views/SettingsNotifications';
|
|
67
|
+
export { default as SettingsUser } from './views/SettingsUser';
|
|
68
|
+
export { default as TimetableCalendar } from './views/TimetableCalendar';
|
|
69
|
+
export { default as TimetableListView } from './views/TimetableList';
|
|
70
|
+
export { default as Webviews } from './views/Webviews';
|
|
71
|
+
|
|
72
|
+
// Exports Contexts
|
|
73
|
+
|
|
74
|
+
export {
|
|
75
|
+
default as CallManagerContext,
|
|
76
|
+
CallManagerContextProvider,
|
|
77
|
+
useCallManagerContext,
|
|
78
|
+
useParallelCalls,
|
|
79
|
+
} from './context/context-callmanager';
|
|
80
|
+
|
|
81
|
+
export {
|
|
82
|
+
default as CanteenContext,
|
|
83
|
+
CanteenContextProvider,
|
|
84
|
+
useCanteenContext,
|
|
85
|
+
useCanteens,
|
|
86
|
+
useCanteen,
|
|
87
|
+
useMenu,
|
|
88
|
+
useFilteredMenu,
|
|
89
|
+
usePriceGroupCode,
|
|
90
|
+
useFavoriteCanteens,
|
|
91
|
+
} from './context/context-canteen';
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
ConnectivityContext,
|
|
95
|
+
ConnectivityContextProvider,
|
|
96
|
+
useConnectivityContext,
|
|
97
|
+
useNetInfo,
|
|
98
|
+
} from './context/context-connectivity';
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
EventContext,
|
|
102
|
+
default as EventContextProvider,
|
|
103
|
+
useEventContext,
|
|
104
|
+
usePersonalEvents,
|
|
105
|
+
useEvents,
|
|
106
|
+
usePersonalEventsCode,
|
|
107
|
+
useEventApiClient,
|
|
108
|
+
} from './context/context-event';
|
|
109
|
+
|
|
110
|
+
export {
|
|
111
|
+
default as FlexMenuContext,
|
|
112
|
+
FlexMenuContextProvider,
|
|
113
|
+
useFlexMenuContext,
|
|
114
|
+
useMenuEntries,
|
|
115
|
+
useChildMenuEntries,
|
|
116
|
+
useMainMenuEntries,
|
|
117
|
+
} from './context/context-flex-menu';
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
default as useMailsContext,
|
|
121
|
+
MailsContextProvider,
|
|
122
|
+
useUnreadEmailCount,
|
|
123
|
+
} from './context/context-mails';
|
|
124
|
+
|
|
125
|
+
export {
|
|
126
|
+
default as NewsContext,
|
|
127
|
+
NewsContextProvider,
|
|
128
|
+
useNewsContext,
|
|
129
|
+
useApiProvider,
|
|
130
|
+
useNewsChannels,
|
|
131
|
+
} from './context/context-news';
|
|
132
|
+
|
|
133
|
+
export {
|
|
134
|
+
PublicTransportTicketContextProvider,
|
|
135
|
+
usePublicTransportTicketContext,
|
|
136
|
+
usePublicTransportTicket,
|
|
137
|
+
} from './context/context-public-transport-ticket';
|
|
138
|
+
|
|
139
|
+
export {
|
|
140
|
+
default as TimetableContext,
|
|
141
|
+
TimetableContextProvider,
|
|
142
|
+
weekModes as CourseWeekModes,
|
|
143
|
+
useTimetableCode,
|
|
144
|
+
useCourses,
|
|
145
|
+
useDateCourses,
|
|
146
|
+
TimetableNotFoundError,
|
|
147
|
+
} from './context/context-timetable';
|
|
148
|
+
|
|
149
|
+
export {
|
|
150
|
+
default as UserContext,
|
|
151
|
+
UserContextProvider,
|
|
152
|
+
useUserContext,
|
|
153
|
+
useAccessToken,
|
|
154
|
+
useIdToken,
|
|
155
|
+
useUser,
|
|
156
|
+
useLogoutEffect,
|
|
157
|
+
} from './context/context-user';
|
|
158
|
+
|
|
159
|
+
// Exports Contexts libraries
|
|
160
|
+
|
|
161
|
+
export {
|
|
162
|
+
default as HttpApiProvider,
|
|
163
|
+
JsonContentType,
|
|
164
|
+
} from './libraries/base-api-provider';
|
|
165
|
+
|
|
166
|
+
export * from './libraries/core';
|
|
167
|
+
|
|
168
|
+
export * from './libraries/core-plugins';
|
|
169
|
+
|
|
170
|
+
export {
|
|
171
|
+
default as IconsOpenasist,
|
|
172
|
+
} from './libraries/icons-openasist';
|
|
173
|
+
|
|
174
|
+
export {
|
|
175
|
+
default as OpenASiSTNotifications,
|
|
176
|
+
} from './libraries/notifications';
|
|
177
|
+
|
|
178
|
+
export * from './libraries/stored-state';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useTheme } from 'react-native-paper';
|
|
4
|
+
|
|
5
|
+
import { useIdToken, useAccessToken } from '../../context/context-user';
|
|
6
|
+
|
|
7
|
+
export function useProvider(provider, providersInitializers) {
|
|
8
|
+
const theme = useTheme();
|
|
9
|
+
const appSettings = theme?.appSettings;
|
|
10
|
+
const accessToken = useAccessToken();
|
|
11
|
+
const idToken = useIdToken();
|
|
12
|
+
const providerInitializer = providersInitializers?.[provider];
|
|
13
|
+
|
|
14
|
+
return useMemo(
|
|
15
|
+
() => {
|
|
16
|
+
return providerInitiliser?.({
|
|
17
|
+
appSettings,
|
|
18
|
+
accessToken,
|
|
19
|
+
idToken,
|
|
20
|
+
})
|
|
21
|
+
},
|
|
22
|
+
[provider, providerInitializer, appSettings, accessToken, idToken]
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API-Client/-Provider der die Grundlage für HTTP/REST bassierte API-Clienten/-Provider benutzt werden kann.
|
|
3
|
+
*/
|
|
4
|
+
export default class HttpApiProvider {
|
|
5
|
+
/**
|
|
6
|
+
* Base URL which is expanded to generate the request URLs.
|
|
7
|
+
* @type {string}
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
#baseUrl
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Prioritised language of retrieved data
|
|
14
|
+
* @type {string[]}
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
#acceptingLanguages
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Content types requested by the server
|
|
21
|
+
* @type {string[]}
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
#acceptingContentTypes
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Access token for authentication
|
|
28
|
+
* @type {string}
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
#accessToken
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Construct a REST API provder.
|
|
35
|
+
* @param {string} baseUrl - URL which is used as the basis for the query URLs.
|
|
36
|
+
* @param {string[]} acceptingLanguages - List of languages that are queried by the ASiST server. The priority is based on the order of the languages in the array.
|
|
37
|
+
* @param {string[]} acceptingContentTypes - List of content types that are queried by the ASiST server. The priority is based on the order of the content types in the array.
|
|
38
|
+
* @param {string} [accessToken=null] OIDC access token which is used for authentication against the API. Default is null
|
|
39
|
+
*/
|
|
40
|
+
constructor(baseUrl, acceptingLanguages, acceptingContentTypes, accessToken = null) {
|
|
41
|
+
this.#baseUrl = baseUrl;
|
|
42
|
+
this.#acceptingLanguages = acceptingLanguages;
|
|
43
|
+
this.#acceptingContentTypes = acceptingContentTypes;
|
|
44
|
+
this.#accessToken = accessToken;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new URL from the base URL and the transferred path segments.
|
|
49
|
+
* @param {string[]} pathSegments - Path segments that are added to the base URL.
|
|
50
|
+
* @returns Base URL extended by segments.
|
|
51
|
+
*/
|
|
52
|
+
extendBaseUrl(pathSegments = []) {
|
|
53
|
+
return new URL(pathSegments.join('/'), this.#baseUrl);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Executes a get request to the passed URL.
|
|
58
|
+
* @param {string|URL} url - URL on which a GET request is executed.
|
|
59
|
+
* @param {object} headers - Headers that are appended to the HTTP request.
|
|
60
|
+
* @returns {Promise<Response>} Promise with the response to the GET request from the server.
|
|
61
|
+
*/
|
|
62
|
+
get(url, headers = {}) {
|
|
63
|
+
return fetch(
|
|
64
|
+
url,
|
|
65
|
+
{
|
|
66
|
+
headers: {
|
|
67
|
+
// Headers des Parameters 'header = {}' werden mit dem Standart-Headern zusammengeführt.
|
|
68
|
+
// Dabei haben Standart-Header höhere Priorität, da diese die Parameter-Header überschreiben.
|
|
69
|
+
...headers,
|
|
70
|
+
...HttpApiProvider.generateHeaders(
|
|
71
|
+
this.#acceptingLanguages,
|
|
72
|
+
this.#acceptingContentTypes,
|
|
73
|
+
this.#accessToken,
|
|
74
|
+
)
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
patch(url, body, headers = null) {
|
|
81
|
+
const jsonBody = JSON.stringify(body);
|
|
82
|
+
|
|
83
|
+
console.debug(this.constructor.name, ':', 'Send PATCH to', url, 'with content', ':', jsonBody);
|
|
84
|
+
|
|
85
|
+
return fetch(
|
|
86
|
+
url,
|
|
87
|
+
{
|
|
88
|
+
method: 'PATCH',
|
|
89
|
+
headers: {
|
|
90
|
+
// Headers des Parameters 'header = {}' werden mit dem Standart-Headern zusammengeführt.
|
|
91
|
+
// Dabei haben Standart-Header höhere Priorität, da diese die Parameter-Header überschreiben.
|
|
92
|
+
...headers,
|
|
93
|
+
...HttpApiProvider.generateHeaders(
|
|
94
|
+
this.#acceptingLanguages,
|
|
95
|
+
this.#acceptingContentTypes,
|
|
96
|
+
this.#accessToken,
|
|
97
|
+
),
|
|
98
|
+
'Content-Type': JsonContentType,
|
|
99
|
+
},
|
|
100
|
+
body: jsonBody,
|
|
101
|
+
},
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Returns standart headers für asist server requests.
|
|
107
|
+
* @param {string[]} acceptingLanguages - List of languages that are queried by the ASiST server. The priority is based on the order of the languages in the array.
|
|
108
|
+
* @param {string[]} acceptingContentTypes - List of the MIME types to be queried by the HTTP API.
|
|
109
|
+
* @param {string} [accessToken=null] OIDC access token which is used for authentication against the API. Default is null.
|
|
110
|
+
* @returns {object} object, which contains the name of the header as the key and the value of the key is the value of the header.
|
|
111
|
+
*/
|
|
112
|
+
// If available implement as private
|
|
113
|
+
static generateHeaders(acceptingLanguages, acceptingContentTypes, accessToken = null) {
|
|
114
|
+
|
|
115
|
+
const accessTokenHeader = accessToken ? HttpApiProvider.generateBearerHeader(accessToken) : null;
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
'Accept': HttpApiProvider.generateHeaderValueFromList(acceptingContentTypes), // Wir wollen JSON zugesendet bekommen
|
|
119
|
+
'Accept-Language': HttpApiProvider.generateHeaderValueFromList(acceptingLanguages), // Wir wollen die Hauptsprache priorisieren
|
|
120
|
+
...accessTokenHeader,
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
static generateBearerHeader(accessToken) {
|
|
125
|
+
return { 'Authorization': `Bearer ${accessToken}` };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Converts a list of string values into a string that symbolises a list of header values.
|
|
130
|
+
* @param {string[]} headerValueList - List of strings to convert.
|
|
131
|
+
* @returns String expressing a header value list.
|
|
132
|
+
*/
|
|
133
|
+
static generateHeaderValueFromList(headerValueList) {
|
|
134
|
+
return headerValueList?.join(', ') ?? null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
static contentTypesFromContentType(contentTyp) {
|
|
138
|
+
return [contentTyp];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Creates an array with language codes depending on the passed main language.
|
|
143
|
+
* @param {string} mainLanguage - Main language which is prioritised.
|
|
144
|
+
* @returns {string[]} List of language codes, with the main language taking priority.
|
|
145
|
+
*/
|
|
146
|
+
static languagesFromMainLanguages(mainLanguage) {
|
|
147
|
+
// Erstellen der Liste an Sprachen anhand der Hauptsprache(mainLanguage)
|
|
148
|
+
|
|
149
|
+
// Prüfen des Sprachparameters
|
|
150
|
+
switch (mainLanguage) {
|
|
151
|
+
case 'de':
|
|
152
|
+
// Wenn Deutsch die Hauptsprache ist, wird Deutsch und nachrangig Englisch als Sprachen ausgewählt
|
|
153
|
+
return ['de', 'en'];
|
|
154
|
+
case 'en':
|
|
155
|
+
// Wenn English die Hauptsprache ist, wird English und nachrangig Deutsch als Sprachen ausgewählt
|
|
156
|
+
return ['en', 'de'];
|
|
157
|
+
default:
|
|
158
|
+
// Wenn Hauptsprache nicht bekannt, wird die Hauptsprache, nachrangig Deutsch und nachrangiger English als Sprachen ausgewählt
|
|
159
|
+
return [mainLanguage, 'de', 'en'];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export const JsonContentType = 'application/json';
|
|
165
|
+
|
|
166
|
+
export const ContentTypes = {
|
|
167
|
+
json: JsonContentType,
|
|
168
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
* you may not use this file except in compliance with the License.
|
|
4
|
+
* You may obtain a copy of the License at
|
|
5
|
+
*
|
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
*
|
|
8
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
* See the License for the specific language governing permissions and
|
|
12
|
+
* limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import HttpApiProvider, { JsonContentType } from './http-api-provider.js';
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
HttpApiProvider as default,
|
|
19
|
+
JsonContentType,
|
|
20
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
|
|
2
|
+
//------------------------------------
|
|
3
|
+
// canteen : Canteens of university
|
|
4
|
+
// -----------------------------------
|
|
5
|
+
|
|
6
|
+
import { ApiSettings, GETOptions, GETOptionsByLanguage } from '../constants/api';
|
|
7
|
+
import {action, commitAction, rollbackAction} from "./../constants/actions";
|
|
8
|
+
import { store } from '../redux/store';
|
|
9
|
+
|
|
10
|
+
export const canteensApi = {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Get all canteens with their menus
|
|
14
|
+
*/
|
|
15
|
+
getAll: (res) => {
|
|
16
|
+
let url = ApiSettings.getApiUrl(ApiSettings.canteen.getAll);
|
|
17
|
+
fetch(url, GETOptions)
|
|
18
|
+
.then((response) => response.json())
|
|
19
|
+
.then((resJson) => {
|
|
20
|
+
if(resJson.canteens) {
|
|
21
|
+
res(resJson.canteens);
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
.catch((error) => {
|
|
25
|
+
console.warn('Error Code: 1003 : ' + error);
|
|
26
|
+
res(null);
|
|
27
|
+
})
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get all canteens with their menus of date {date} with format 'yyyy-MM-dd'
|
|
33
|
+
*
|
|
34
|
+
* @param date
|
|
35
|
+
* @param res
|
|
36
|
+
*/
|
|
37
|
+
getByDate: (date, res) => {
|
|
38
|
+
let url = ApiSettings.getApiUrl(ApiSettings.canteen.getByDate);
|
|
39
|
+
url = url.replace('{date}', date);
|
|
40
|
+
|
|
41
|
+
fetch(url, GETOptions)
|
|
42
|
+
.then((response) => response.json())
|
|
43
|
+
.then((resJson) => {
|
|
44
|
+
res(resJson);
|
|
45
|
+
})
|
|
46
|
+
.catch((error) => {
|
|
47
|
+
console.warn('Error Code: 1004 : ' + error);
|
|
48
|
+
res(null);
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
// REDUX - OFFLINE
|
|
55
|
+
|
|
56
|
+
const defaultType = action.canteen.getAll;
|
|
57
|
+
|
|
58
|
+
export const updateTodayMeals = () => {
|
|
59
|
+
|
|
60
|
+
const language = store.getState().settingReducer.settingsGeneral.language;
|
|
61
|
+
const headers = GETOptionsByLanguage(language).headers;
|
|
62
|
+
return {
|
|
63
|
+
type: defaultType,
|
|
64
|
+
meta: {
|
|
65
|
+
offline: {
|
|
66
|
+
effect: { url: ApiSettings.getApiUrl(ApiSettings.canteen.getAll), method: 'GET', headers},
|
|
67
|
+
commit: { type: defaultType + commitAction },
|
|
68
|
+
rollback: { type: defaultType + rollbackAction }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const updateAllMeals = () => {
|
|
75
|
+
const language = store.getState().settingReducer.settingsGeneral.language;
|
|
76
|
+
const headers = GETOptionsByLanguage(language).headers;
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
type: action.canteen.getAll,
|
|
80
|
+
meta: {
|
|
81
|
+
offline: {
|
|
82
|
+
effect: { url: ApiSettings.getApiUrl(ApiSettings.canteen.getAll), method: 'GET', headers },
|
|
83
|
+
commit: { type: action.canteen.getAll + commitAction },
|
|
84
|
+
rollback: { type: action.canteen.getAll + rollbackAction }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
//------------------------------------
|
|
3
|
+
// canteen : Canteens of university
|
|
4
|
+
// -----------------------------------
|
|
5
|
+
|
|
6
|
+
import {ApiSettings, GETOptions} from '../constants/api';
|
|
7
|
+
import {action, commitAction, rollbackAction} from "../constants/actions";
|
|
8
|
+
|
|
9
|
+
export const coronaApi = {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Get corona menu
|
|
13
|
+
*/
|
|
14
|
+
getCoronaMenu: (res) => {
|
|
15
|
+
let url = ApiSettings.getApiUrl(ApiSettings.corona.getCoronaMenu)
|
|
16
|
+
|
|
17
|
+
fetch(url, GETOptions)
|
|
18
|
+
.then((response) => response.json())
|
|
19
|
+
.then((resJson) => {
|
|
20
|
+
if(resJson) {
|
|
21
|
+
res(resJson);
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
.catch((error) => {
|
|
25
|
+
console.warn('Error Code: 1005 : ' + error);
|
|
26
|
+
res(null);
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// REDUX - OFFLINE
|
|
33
|
+
|
|
34
|
+
const defaultType = action.corona.getCoronaMenu;
|
|
35
|
+
|
|
36
|
+
export const updateCoronaMenu = () => ({
|
|
37
|
+
type: defaultType,
|
|
38
|
+
meta: {
|
|
39
|
+
offline: {
|
|
40
|
+
effect: { url: ApiSettings.getApiUrl(ApiSettings.corona.getCoronaMenu), method: 'GET' },
|
|
41
|
+
commit: { type: defaultType + commitAction },
|
|
42
|
+
rollback: { type: defaultType + rollbackAction }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
//------------------------------------
|
|
3
|
+
// course : Courses of university
|
|
4
|
+
// -----------------------------------
|
|
5
|
+
|
|
6
|
+
import {ApiSettings, GETOptions} from '../constants/api';
|
|
7
|
+
import {action, commitAction, rollbackAction} from "./../constants/actions";
|
|
8
|
+
|
|
9
|
+
const defaultType = action.coursesV2.getCourses;
|
|
10
|
+
|
|
11
|
+
export const coursesApi = {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get courses by short code and device id
|
|
15
|
+
*/
|
|
16
|
+
getCourses: (timetableCode, res) => {
|
|
17
|
+
let url = ApiSettings.getApiUrl(ApiSettings.coursesV2.getCourses);
|
|
18
|
+
url = url.replace('{timetableCode}', timetableCode);
|
|
19
|
+
|
|
20
|
+
fetch(url, GETOptions)
|
|
21
|
+
.then((response) => response.json())
|
|
22
|
+
.then((resJson) => {
|
|
23
|
+
res(resJson);
|
|
24
|
+
})
|
|
25
|
+
.catch((error) => {
|
|
26
|
+
console.warn('Error Code: 1006 : ' + error);
|
|
27
|
+
res(null);
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// REDUX - OFFLINE
|
|
34
|
+
|
|
35
|
+
export const updateCourses = (timetableCode, hideErrors) => {
|
|
36
|
+
const headers = GETOptions.headers;
|
|
37
|
+
let url = ApiSettings.getApiUrl(ApiSettings.coursesV2.getCourses);
|
|
38
|
+
url = url.replace('{timetableCode}', timetableCode);
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
type: defaultType,
|
|
42
|
+
meta: {
|
|
43
|
+
offline: {
|
|
44
|
+
effect: {
|
|
45
|
+
url,
|
|
46
|
+
method: 'GET',
|
|
47
|
+
headers
|
|
48
|
+
},
|
|
49
|
+
commit: { type: defaultType + commitAction },
|
|
50
|
+
rollback: { type: defaultType + rollbackAction, hideErrors }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
|
|
2
|
+
//------------------------------------
|
|
3
|
+
// device : Registration service for devices
|
|
4
|
+
// -----------------------------------
|
|
5
|
+
|
|
6
|
+
import {ApiSettings, POSTOptions} from '../constants/api';
|
|
7
|
+
import {action, commitAction, rollbackAction} from "./../constants/actions";
|
|
8
|
+
import {Platform} from 'react-native';
|
|
9
|
+
|
|
10
|
+
export const deviceApi = {
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Resgister a new device
|
|
15
|
+
*/
|
|
16
|
+
postRegisterDevice: (type, res) => {
|
|
17
|
+
let url = ApiSettings.getApiUrl(ApiSettings.device.postRegisterDevice);
|
|
18
|
+
url = url.replace('{type}', type);
|
|
19
|
+
|
|
20
|
+
fetch(url, POSTOptions)
|
|
21
|
+
.then((response) => response.json())
|
|
22
|
+
.then((resJson) => {
|
|
23
|
+
res(resJson);
|
|
24
|
+
})
|
|
25
|
+
.catch((error) => {
|
|
26
|
+
console.warn('Error Code: 1007 : ' + error);
|
|
27
|
+
res(null);
|
|
28
|
+
})
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Post lms
|
|
33
|
+
*/
|
|
34
|
+
postLMS: (pushUid, res) => {
|
|
35
|
+
let url = ApiSettings.getApiUrl(ApiSettings.device.postLMS);
|
|
36
|
+
url = url.replace('{pushuid}', pushUid);
|
|
37
|
+
|
|
38
|
+
fetch(url, POSTOptions)
|
|
39
|
+
.then((response) => response.json())
|
|
40
|
+
.then((resJson) => {
|
|
41
|
+
res(resJson);
|
|
42
|
+
})
|
|
43
|
+
.catch((error) => {
|
|
44
|
+
console.warn('Error Code: 1008 : ' + error);
|
|
45
|
+
res(null);
|
|
46
|
+
})
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Post device settings
|
|
51
|
+
*/
|
|
52
|
+
postSettings: (module, value, res) => {
|
|
53
|
+
let url = ApiSettings.getApiUrl(ApiSettings.device.postSettings);
|
|
54
|
+
url = url.replace('{module}', module);
|
|
55
|
+
url = url.replace('{value}', value);
|
|
56
|
+
|
|
57
|
+
fetch(url, POSTOptions)
|
|
58
|
+
.then((response) => response.json())
|
|
59
|
+
.then((resJson) => {
|
|
60
|
+
res(resJson);
|
|
61
|
+
})
|
|
62
|
+
.catch((error) => {
|
|
63
|
+
console.warn('Error Code: 1009 : ' + error);
|
|
64
|
+
res(null);
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
// REDUX - OFFLINE
|
|
72
|
+
|
|
73
|
+
const defaultType = action.device.postRegisterDevice;
|
|
74
|
+
const generateToken = () => {
|
|
75
|
+
let token = '';
|
|
76
|
+
for (var i = 0; i <= 1; i++) {
|
|
77
|
+
token += Math.random().toString(36).substr(2);
|
|
78
|
+
}
|
|
79
|
+
return token;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
export const registerDevice = () => ({
|
|
84
|
+
type: defaultType,
|
|
85
|
+
meta: {
|
|
86
|
+
offline: {
|
|
87
|
+
effect: {
|
|
88
|
+
url: ApiSettings.getApiUrl(ApiSettings.device.postRegisterDevice),
|
|
89
|
+
method: 'POST',
|
|
90
|
+
body: 'token='+ generateToken() + '&type=' + (Platform.OS === 'ios' ? 'IOS' : 'ANDROID'),
|
|
91
|
+
headers: { 'content-type': 'application/x-www-form-urlencoded' }
|
|
92
|
+
},
|
|
93
|
+
commit: { type: defaultType + commitAction },
|
|
94
|
+
rollback: { type: defaultType + rollbackAction }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|