Browse Source

Allow navigating to amicale services section without being logged in

Arnaud Vergnet 3 years ago
parent
commit
217e918ce8
1 changed files with 11 additions and 33 deletions
  1. 11
    33
      src/screens/Services/ServicesSectionScreen.js

+ 11
- 33
src/screens/Services/ServicesSectionScreen.js View File

@@ -6,10 +6,7 @@ import CustomTabBar from "../../components/Tabbar/CustomTabBar";
6 6
 import {withCollapsible} from "../../utils/withCollapsible";
7 7
 import {Collapsible} from "react-navigation-collapsible";
8 8
 import {CommonActions} from "@react-navigation/native";
9
-import ConnectionManager from "../../managers/ConnectionManager";
10 9
 import type {listItem} from "./ServicesScreen";
11
-import ErrorView from "../../components/Screens/ErrorView";
12
-import {ERROR_TYPE} from "../../utils/WebData";
13 10
 
14 11
 type Props = {
15 12
     navigation: Object,
@@ -17,29 +14,13 @@ type Props = {
17 14
     collapsibleStack: Collapsible,
18 15
 }
19 16
 
20
-type State = {
21
-    isLoggedIn: boolean,
22
-}
23
-
24
-class ServicesSectionScreen extends React.Component<Props, State> {
17
+class ServicesSectionScreen extends React.Component<Props> {
25 18
 
26 19
     finalDataset: listItem;
27 20
 
28 21
     constructor(props) {
29 22
         super(props);
30 23
         this.handleNavigationParams();
31
-        this.state = {
32
-            isLoggedIn: ConnectionManager.getInstance().isLoggedIn(),
33
-        }
34
-    }
35
-
36
-    componentDidMount() {
37
-        this.props.navigation.addListener('focus', this.onFocus);
38
-
39
-    }
40
-
41
-    onFocus = () => {
42
-        this.setState({isLoggedIn: ConnectionManager.getInstance().isLoggedIn()})
43 24
     }
44 25
 
45 26
     handleNavigationParams() {
@@ -57,19 +38,16 @@ class ServicesSectionScreen extends React.Component<Props, State> {
57 38
 
58 39
     render() {
59 40
         const {containerPaddingTop, scrollIndicatorInsetTop, onScroll} = this.props.collapsibleStack;
60
-        if (!this.state.isLoggedIn && this.finalDataset.shouldLogin)
61
-            return <ErrorView {...this.props} errorCode={ERROR_TYPE.BAD_TOKEN}/>;
62
-        else
63
-            return <CardList
64
-                dataset={this.finalDataset.content}
65
-                isHorizontal={false}
66
-                onScroll={onScroll}
67
-                contentContainerStyle={{
68
-                    paddingTop: containerPaddingTop,
69
-                    paddingBottom: CustomTabBar.TAB_BAR_HEIGHT + 20
70
-                }}
71
-                scrollIndicatorInsets={{top: scrollIndicatorInsetTop}}
72
-            />
41
+        return <CardList
42
+            dataset={this.finalDataset.content}
43
+            isHorizontal={false}
44
+            onScroll={onScroll}
45
+            contentContainerStyle={{
46
+                paddingTop: containerPaddingTop,
47
+                paddingBottom: CustomTabBar.TAB_BAR_HEIGHT + 20
48
+            }}
49
+            scrollIndicatorInsets={{top: scrollIndicatorInsetTop}}
50
+        />
73 51
     }
74 52
 }
75 53
 

Loading…
Cancel
Save