aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/services')
-rw-r--r--src/services/NotificationService.ts51
-rw-r--r--src/services/SocialLinkingService.ts21
2 files changed, 35 insertions, 37 deletions
diff --git a/src/services/NotificationService.ts b/src/services/NotificationService.ts
index a62b0df9..c5c843f5 100644
--- a/src/services/NotificationService.ts
+++ b/src/services/NotificationService.ts
@@ -2,31 +2,30 @@ import AsyncStorage from '@react-native-community/async-storage';
import {NOTIFICATIONS_ENDPOINT} from '../constants';
import {NotificationType} from '../types';
-export const getNotificationsData: () => Promise<
- NotificationType[]
-> = async () => {
- try {
- const token = await AsyncStorage.getItem('token');
- const response = await fetch(NOTIFICATIONS_ENDPOINT, {
- method: 'GET',
- headers: {
- Authorization: 'Token ' + token,
- },
- });
- if (response.status === 200) {
- const data: any[] = await response.json();
- let typedData: NotificationType[] = [];
- for (const o of data) {
- typedData.push({
- ...o.notification,
- unread: false,
- });
+export const getNotificationsData: () => Promise<NotificationType[]> =
+ async () => {
+ try {
+ const token = await AsyncStorage.getItem('token');
+ const response = await fetch(NOTIFICATIONS_ENDPOINT, {
+ method: 'GET',
+ headers: {
+ Authorization: 'Token ' + token,
+ },
+ });
+ if (response.status === 200) {
+ const data: any[] = await response.json();
+ let typedData: NotificationType[] = [];
+ for (const o of data) {
+ typedData.push({
+ ...o.notification,
+ unread: false,
+ });
+ }
+ return typedData;
}
- return typedData;
+ return [];
+ } catch (error) {
+ console.log('Unable to fetch notifications');
+ return [];
}
- return [];
- } catch (error) {
- console.log('Unable to fetch notifications');
- return [];
- }
-};
+ };
diff --git a/src/services/SocialLinkingService.ts b/src/services/SocialLinkingService.ts
index 90b26c96..77caceec 100644
--- a/src/services/SocialLinkingService.ts
+++ b/src/services/SocialLinkingService.ts
@@ -107,17 +107,16 @@ export const registerIntegratedSocialLink: (
// Twitter is a special case since they use OAuth1, we will need to request
// for a request_token before we can begin browser signin.
-export const getTwitterRequestToken: (
- user_token: string,
-) => Promise<string> = async (user_token) => {
- const response = await fetch(integratedEndpoints.Twitter[0], {
- method: 'GET',
- headers: {
- Authorization: `Token ${user_token}`,
- },
- });
- return response.url;
-};
+export const getTwitterRequestToken: (user_token: string) => Promise<string> =
+ async (user_token) => {
+ const response = await fetch(integratedEndpoints.Twitter[0], {
+ method: 'GET',
+ headers: {
+ Authorization: `Token ${user_token}`,
+ },
+ });
+ return response.url;
+ };
// one stop shop for handling all browser sign-in social linkings
export const handlePressForAuthBrowser: (