Browse Source

ADD link from rohit with correct callback

Jordi Coscolla 1 year ago
parent
commit
c5f87b2d5b

+ 1 - 0
apps/petitions/petitions-app/.eslintrc.json

@@ -18,6 +18,7 @@
18 18
     "expoLink": true,
19 19
     "walletLink": true,
20 20
     "expoLoginLink": true,
21
+    "expoBCNNowLoginLink": true,
21 22
     "$": true,
22 23
     "neptuneUrl": true,
23 24
     "atlantisUrl": true

+ 4 - 2
apps/petitions/petitions-app/config.json

@@ -3,12 +3,14 @@
3 3
     "api": "http://localhost:3040",
4 4
     "expoLink": "exp://localhost:19000?",
5 5
     "walletLink": "decodewallet://localhost:19000?",
6
-    "expoLoginLink": "exp://localhost:19000?header={predicate:\"schema:iotCommunity\"}&sessionId=9876&callback=http://bcnnow.decodeproject.eu/wallet-login&action=login"
6
+    "expoLoginLink": "exp://localhost:19000?header={predicate:\"schema:iotCommunity\"}&sessionId=9876&callback=http://bcnnow.decodeproject.eu/wallet-login&action=login",
7
+    "expoBCNNowLoginLink": "exp://localhost:19000?action=login&header={predicate:'schema:iotCommunity'}&sessionId=d66b96fa6593be9bf98c3bca&callback=http://93ff8837.ngrok.io/iotlogin/validate"
7 8
   },
8 9
   "production": {
9 10
     "api" : "http://ec2-34-253-207-49.eu-west-1.compute.amazonaws.com",
10 11
     "expoLink" : "exp://exp.host/@decode-barcelona/decode-walletapp?release-channel=production",
11 12
     "walletLink": "decodewallet://exp.host/@decode-barcelona/decode-walletapp?release-channel=production",
12
-    "expoLoginLink": "exp://login?header={predicate:\"schema:iotCommunity\"}&sessionId=9876&callback=http://bcnnow.decodeproject.eu/wallet-login"
13
+    "expoLoginLink": "exp://login?header={predicate:\"schema:iotCommunity\"}&sessionId=9876&callback=http://bcnnow.decodeproject.eu/wallet-login",
14
+    "expoBCNNowLoginLink": "exp://localhost:19000?action=login&header={predicate:'schema:iotCommunity'}&sessionId=d66b96fa6593be9bf98c3bca&callback=http://93ff8837.ngrok.io/iotlogin/validate"
13 15
   }
14 16
 }

+ 2 - 1
apps/petitions/petitions-app/package.json

@@ -59,7 +59,8 @@
59 59
       "API": "blah",
60 60
       "expoLink": "foo",
61 61
       "walletLink": "foo",
62
-      "expoLoginLink": "foo"
62
+      "expoLoginLink": "foo",
63
+      "expoBCNNowLoginLink": "foo"
63 64
     }
64 65
   }
65 66
 }

+ 2 - 0
apps/petitions/petitions-app/src/components/PetitionList.jsx

@@ -55,6 +55,8 @@ class PetitionList extends Component {
55 55
         <Header />
56 56
         <Main>
57 57
           <a href={`${expoLoginLink}`}>Login to Dashboard</a>
58
+          <br />
59
+          <a href={`${expoBCNNowLoginLink}`}>Login to BCNNOW Dashboard</a>
58 60
           {this.state.serverError ?
59 61
             <ErrorMessage>Sorry, there was an error loading the page</ErrorMessage> :
60 62
             <div>

+ 12 - 0
apps/petitions/petitions-app/webpack.config.js

@@ -53,6 +53,17 @@ const getExpoLoginLink = () => {
53 53
   }
54 54
 };
55 55
 
56
+const getBCNNOWExpoLoginLink = () => {
57
+  if (process.env.IP) {
58
+    return config.development.expoBCNNowLoginLink.replace('localhost', process.env.IP);
59
+  }
60
+  switch (process.env.NODE_ENV) {
61
+    case 'production':
62
+      return config.production.expoBCNNowLoginLink;
63
+    default:
64
+      return config.development.expoBCNNowLoginLink;
65
+  }
66
+};
56 67
 module.exports = {
57 68
   entry: ['whatwg-fetch', 'babel-polyfill', './src/index.jsx'],
58 69
   output: {
@@ -81,6 +92,7 @@ module.exports = {
81 92
       expoLink: JSON.stringify(getExpoLink()),
82 93
       walletLink: JSON.stringify(getWalletLink()),
83 94
       expoLoginLink: JSON.stringify(getExpoLoginLink()),
95
+      expoBCNNowLoginLink: JSON.stringify(getBCNNOWExpoLoginLink()),
84 96
     }),
85 97
     new CopyWebpackPlugin([
86 98
       // {output}/to/file.txt