Skip to content

Commit 7c0edbd

Browse files
committed
Updated with slack example
1 parent 029d861 commit 7c0edbd

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Release-iphonesimulator/
4949
ios/FirestackApp/FirestackApp.entitlements
5050
coverage/
5151
ios/Pods
52+
config/all.js
5253
config/development.js
5354
config/development.android.js
5455

app/views/Authentication/Demos/Providers.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ const opts = {
1919
google: {scopes: 'email,profile'},
2020
facebook: {},
2121
twitter: {},
22-
github: {},
22+
github: {
23+
scopes: 'notifications,profile'
24+
},
2325
slack: {scopes: 'channels:read'}
2426
}
2527

@@ -137,15 +139,16 @@ export class Providers extends React.Component {
137139
});
138140
}
139141
} else if (provider === 'github') {
140-
url = '/users/auser/events'
142+
url = '/notifications'
141143
handleResp = resp => {
142144
const {data} = resp;
143-
const newData = data.map(d => ({id: d.id, text: `${d.type}: ${d.repo.name}`}))
145+
const newData = data.map(d => ({id: d.id, text: `${d.reason}: ${d.repository.name}`}))
144146
this.setState({ data: newData });
145147
}
146148
} else if (provider === 'slack') {
147149
url = '/channels.list'
148150
handleResp = resp => {
151+
console.log('resp ->', resp);
149152
const {channels} = resp.data
150153
const newData = channels.map(d => ({id: d.id, text: `${d.name}`}))
151154
this.setState({ data: newData });

config/all.example.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
firestack: {
3+
debug: '*'
4+
},
5+
auth: {}
6+
}

config/environment.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
import { Platform } from 'react-native';
2+
import _ from 'lodash';
3+
4+
const NODE_ENV = process.env.NODE_ENV;
25

36
let defaultEnv = {
47
NAME: 'DoGood'
58
}
69

7-
const NODE_ENV = process.env.NODE_ENV;
10+
let general = {};
11+
try {
12+
general = require('./all');
13+
} catch (e) {}
14+
815
let env = {}
916
if (NODE_ENV === 'development') {
1017
env = require('./development')
1118
}
1219

13-
try {
14-
env = Object.assign({}, env, require(`${NODE_ENV}.${Platform.OS}`));
15-
} catch (e) {}
20+
env = _.merge({}, general, env);
1621

1722
module.exports = Object.assign({}, defaultEnv, env);

0 commit comments

Comments
 (0)