Browse Source

SQUASH: use redux to get config

j8
Leonard Kim 8 years ago
parent
commit
9e7f8d0e16
1 changed files with 6 additions and 26 deletions
  1. 6
    26
      react/features/invite/actions.js

+ 6
- 26
react/features/invite/actions.js View File

@@ -8,29 +8,6 @@ import { InviteDialog } from './components';
8 8
 
9 9
 declare var $: Function;
10 10
 declare var APP: Object;
11
-declare var config: Object;
12
-
13
-/**
14
- * The url for the api that matches a conference name and muc to an id.
15
- *
16
- * @type {string}
17
- */
18
-const DIAL_IN_CONF_CODE_URL = config.dialInConfCodeUrl;
19
-
20
-/**
21
- * The url for the api that returns phone numbers to dial in to the conference
22
- * and join using the conference id.
23
- *
24
- * @type {string}
25
- */
26
-const DIAL_IN_NUMBERS_URLS = config.dialInNumbersUrl;
27
-
28
-/**
29
- * The url for the MUC component joined for the conference.
30
- *
31
- * @type {string}
32
- */
33
-const MUC_URL = config.hosts && config.hosts.muc;
34 11
 
35 12
 /**
36 13
  * Opens the Invite Dialog.
@@ -50,8 +27,11 @@ export function openInviteDialog() {
50 27
  */
51 28
 export function updateDialInNumbers() {
52 29
     return (dispatch, getState) => {
30
+        const { dialInConfCodeUrl, dialInNumbersUrl, hosts }
31
+            = getState()['features/base/config'];
32
+        const mucUrl = hosts && hosts.muc;
53 33
 
54
-        if (!DIAL_IN_CONF_CODE_URL || !DIAL_IN_NUMBERS_URLS || !MUC_URL) {
34
+        if (!dialInConfCodeUrl || !dialInNumbersUrl || !mucUrl) {
55 35
             dispatch({
56 36
                 type: UPDATE_DIAL_IN_NUMBERS_FAILED,
57 37
                 error: 'URLs for fetching dial in numbers not properly defined'
@@ -62,10 +42,10 @@ export function updateDialInNumbers() {
62 42
 
63 43
         const { room } = getState()['features/base/conference'];
64 44
         const conferenceIdUrl
65
-            = `${DIAL_IN_CONF_CODE_URL}?conference=${room}@${MUC_URL}`;
45
+            = `${dialInConfCodeUrl}?conference=${room}@${mucUrl}`;
66 46
 
67 47
         Promise.all([
68
-            $.getJSON(DIAL_IN_NUMBERS_URLS),
48
+            $.getJSON(dialInNumbersUrl),
69 49
             $.getJSON(conferenceIdUrl)
70 50
         ]).then(([ numbersResponse, idResponse ]) => {
71 51
             if (!idResponse.conference || !idResponse.id) {

Loading…
Cancel
Save