Browse Source

feat(invite): move JWT to Authorization header for invite and search endpoints (#14777)

factor2
Aaron van Meerten 1 year ago
parent
commit
9af0003c63
No account linked to committer's email address
1 changed files with 16 additions and 5 deletions
  1. 16
    5
      react/features/invite/functions.ts

+ 16
- 5
react/features/invite/functions.ts View File

427
         return Promise.resolve();
427
         return Promise.resolve();
428
     }
428
     }
429
 
429
 
430
+    const headers = {
431
+        ...jwt ? { 'Authorization': `Bearer ${jwt}` } : {},
432
+        'Content-Type': 'application/json'
433
+    };
434
+
430
     return fetch(
435
     return fetch(
431
-        `${inviteServiceUrl}?token=${jwt}`,
436
+        `${inviteServiceUrl}`,
432
         {
437
         {
433
             body: JSON.stringify({
438
             body: JSON.stringify({
434
                 'invited': inviteItems,
439
                 'invited': inviteItems,
435
                 'url': inviteUrl
440
                 'url': inviteUrl
436
             }),
441
             }),
437
             method: 'POST',
442
             method: 'POST',
438
-            headers: {
439
-                'Content-Type': 'application/json'
440
-            }
443
+            headers
441
         }
444
         }
442
     );
445
     );
443
 }
446
 }
544
     const query = encodeURIComponent(text);
547
     const query = encodeURIComponent(text);
545
     const queryTypesString = encodeURIComponent(JSON.stringify(queryTypes));
548
     const queryTypesString = encodeURIComponent(JSON.stringify(queryTypes));
546
 
549
 
550
+    const headers = {
551
+        ...jwt ? { 'Authorization': `Bearer ${jwt}` } : {}
552
+    };
553
+
547
     return fetch(`${serviceUrl}?query=${query}&queryTypes=${
554
     return fetch(`${serviceUrl}?query=${query}&queryTypes=${
548
-        queryTypesString}&jwt=${jwt}`)
555
+        queryTypesString}`,
556
+            {
557
+                method: 'GET',
558
+                headers
559
+            })
549
             .then(response => {
560
             .then(response => {
550
                 const jsonify = response.json();
561
                 const jsonify = response.json();
551
 
562
 

Loading…
Cancel
Save