소스 검색

sentry fixes

Viktoriia 10 달 전
부모
커밋
105baf59eb

+ 2 - 1
App.tsx

@@ -23,7 +23,8 @@ const routingInstrumentation = new Sentry.ReactNavigationInstrumentation({
 Sentry.init({
   dsn: 'https://c9b37005f4be22a17a582603ebc17598@o4507781200543744.ingest.de.sentry.io/4507781253824592',
   integrations: [new Sentry.ReactNativeTracing({ routingInstrumentation })],
-  debug: false
+  debug: false,
+  ignoreErrors: ['Network Error', 'ECONNABORTED', 'timeout of 10000ms exceeded'],
 });
 
 const App = () => {

+ 4 - 3
src/database/seriesRankingService/index.ts

@@ -12,13 +12,14 @@ function saveData<T>(key: string, data: T) {
 export async function saveSeriesRankingData() {
   const response = await seriesApi.getSeriesGroupsRanking();
   if (response && response.data) {
-    const groups = response.data.data;
-    saveData('groups', groups);
+    const groups = response?.data?.data;
+    groups && saveData('groups', groups);
+    if (!groups) return;
 
     await Promise.all(
       groups.map(async (group) => {
         const res = await seriesApi.getSeriesRanking(group.id, 0, 50);
-        saveData(`${group.id}`, res.data.data);
+        res?.data?.data && saveData(`${group.id}`, res.data.data);
 
         if (group.series) {
           group.series.map(async (series) => {

+ 4 - 1
src/modules/api/app/queries/use-post-last-dare-db-update.tsx

@@ -6,7 +6,10 @@ export const fetchLastDareDbUpdate = async (date: string) => {
   try {
     const data: PostGetLastUpdate = await queryClient.fetchQuery({
       queryKey: appQueryKeys.getLastDareUpdate(),
-      queryFn: () => appApi.getLastDareUpdate(date).then((res) => res.data),
+      queryFn: async () => {
+        const response = await appApi.getLastDareUpdate(date);
+        return response.data;
+      },
       gcTime: 0,
       staleTime: 0
     });

+ 4 - 1
src/modules/api/app/queries/use-post-last-regions-db-update.tsx

@@ -6,7 +6,10 @@ export const fetchLastRegionsDbUpdate = async (date: string) => {
   try {
     const data: PostGetLastUpdate = await queryClient.fetchQuery({
       queryKey: appQueryKeys.getLastRegionsUpdate(),
-      queryFn: () => appApi.getLastRegionsUpdate(date).then((res) => res.data),
+      queryFn: async () => {
+        const response = await appApi.getLastRegionsUpdate(date);
+        return response.data;
+      },
       gcTime: 0,
       staleTime: 0
     });

+ 4 - 1
src/modules/api/avatars/queries/use-post-get-avatars.tsx

@@ -6,7 +6,10 @@ export const fetchUpdatedAvatars = async (date: string) => {
   try {
     const data: PostGetAvatars = await queryClient.fetchQuery({
       queryKey: avatarsQueryKeys.getUpdatedAvatars(date),
-      queryFn: () => avatarsApi.getUpdatedAvatars(date).then((res) => res.data),
+      queryFn: async () => {
+        const response = await avatarsApi.getUpdatedAvatars(date);
+        return response.data;
+      },
       gcTime: 0,
       staleTime: 0
     });

+ 4 - 1
src/modules/api/friends/queries/use-post-is-notification-active.tsx

@@ -6,7 +6,10 @@ export const fetchFriendsNotification = async (token: string) => {
   try {
     const data: PostGetFriendsNotificationReturn = await queryClient.fetchQuery({
       queryKey: friendsQueryKeys.getNotification(token),
-      queryFn: () => friendsApi.getNotification(token).then((res) => res.data),
+      queryFn: async () => {
+        const response = await friendsApi.getNotification(token);
+        return response.data;
+      },
       gcTime: 0,
       staleTime: 0
     });

+ 5 - 2
src/modules/api/ranking/queries/use-post-get-in-history.tsx

@@ -6,11 +6,14 @@ export const fetchInHistory = async () => {
   try {
     const data: PostGetRanking = await queryClient.fetchQuery({
       queryKey: rankingQueryKeys.getInHistory(),
-      queryFn: () => rankingApi.getInHistory().then((res) => res.data),
+      queryFn: async () => {
+        const response = await rankingApi.getInHistory();
+        return response.data;
+      },
       gcTime: 0,
       staleTime: 0
     });
-    
+
     return data;
   } catch (error) {
     console.error('Failed to fetch in-history data:', error);

+ 4 - 1
src/modules/api/ranking/queries/use-post-get-in-memoriam.tsx

@@ -6,7 +6,10 @@ export const fetchInMemoriam = async () => {
   try {
     const data: PostGetRanking = await queryClient.fetchQuery({
       queryKey: rankingQueryKeys.getInMemoriam(),
-      queryFn: () => rankingApi.getInMemoriam().then((res) => res.data),
+      queryFn: async () => {
+        const response = await rankingApi.getInMemoriam();
+        return response.data;
+      },
       gcTime: 0,
       staleTime: 0
     });

+ 4 - 1
src/modules/api/ranking/queries/use-post-get-limited-ranking.tsx

@@ -6,7 +6,10 @@ export const fetchLimitedRanking = async () => {
   try {
     const data: PostGetRanking = await queryClient.fetchQuery({
       queryKey: rankingQueryKeys.getLimitedRanking(),
-      queryFn: () => rankingApi.getLimitedRanking().then((res) => res.data),
+      queryFn: async () => {
+        const response = await rankingApi.getLimitedRanking();
+        return response.data;
+      },
       gcTime: 0,
       staleTime: 0
     });

+ 5 - 2
src/modules/api/ranking/queries/use-post-get-lpi.tsx

@@ -6,11 +6,14 @@ export const fetchLpi = async () => {
   try {
     const data: PostGetRanking = await queryClient.fetchQuery({
       queryKey: rankingQueryKeys.getLpi(),
-      queryFn: () => rankingApi.getLpi().then((res) => res.data),
+      queryFn: async () => {
+        const response = await rankingApi.getLpi();
+        return response.data;
+      },
       gcTime: 0,
       staleTime: 0
     });
-    
+
     return data;
   } catch (error) {
     console.error('Failed to fetch lpi data:', error);

+ 8 - 2
src/modules/api/ranking/queries/use-post-get-un-masters.tsx

@@ -12,7 +12,10 @@ export const fetchUNMastersTypes = async () => {
   try {
     const data: PostGetUNTypes = await queryClient.fetchQuery({
       queryKey: rankingQueryKeys.getUNMastersTypes(),
-      queryFn: () => rankingApi.getUNMastersTypes().then((res) => res.data),
+      queryFn: async () => {
+        const response = await rankingApi.getUNMastersTypes();
+        return response.data;
+      },
       gcTime: 0,
       staleTime: 0
     });
@@ -27,7 +30,10 @@ export const fetchUNMastersType = async (type: number) => {
   try {
     const data: PostGetUNType | CountryUNType | YearUNType = await queryClient.fetchQuery({
       queryKey: rankingQueryKeys.getUNMastersType(type),
-      queryFn: () => rankingApi.getUNMastersType(type).then((res) => res.data),
+      queryFn: async () => {
+        const response = await rankingApi.getUNMastersType(type);
+        return response.data;
+      },
       gcTime: 0,
       staleTime: 0
     });

+ 4 - 1
src/modules/api/series/queries/use-post-get-items-for-series.tsx

@@ -7,7 +7,10 @@ export const fetchItemsForSeries = async (token: string, series_id: string) => {
   try {
     const data: PostGetItems = await queryClient.fetchQuery({
       queryKey: seriesQueryKeys.getItemsForSeries(token, series_id),
-      queryFn: () => seriesApi.getItemsForSeries(token, series_id).then((res) => res.data),
+      queryFn: async () => {
+        const response = await seriesApi.getItemsForSeries(token, series_id);
+        return response.data;
+      },
       gcTime: 0,
       staleTime: 0
     });

+ 8 - 2
src/modules/api/statistics/queries/use-post-get-statistics.tsx

@@ -6,7 +6,10 @@ export const fetchList = async (token: string) => {
   try {
     const data: PostGetList = await queryClient.fetchQuery({
       queryKey: statisticsQueryKeys.getList(token),
-      queryFn: () => statisticsApi.getList(token).then((res) => res.data),
+      queryFn: async () => {
+        const response = await statisticsApi.getList(token);
+        return response.data;
+      },
       gcTime: 0,
       staleTime: 0
     });
@@ -21,7 +24,10 @@ export const fetchStatistic = async (token: string, url1: string, url2: string)
   try {
     const data: PostGetStat = await queryClient.fetchQuery({
       queryKey: statisticsQueryKeys.getStatistic(token, url1, url2),
-      queryFn: () => statisticsApi.getStatistic(token, url1, url2).then((res) => res.data),
+      queryFn: async () => {
+        const response = await statisticsApi.getStatistic(token, url1, url2);
+        return response.data;
+      },
       gcTime: 0,
       staleTime: 0
     });

+ 1 - 1
src/screens/InAppScreens/ProfileScreen/Components/PersonalInfo.tsx

@@ -276,7 +276,7 @@ export const PersonalInfo: FC<PersonalInfoProps> = ({
                       />
                     ) : (
                       <AvatarWithInitials
-                        text={`${friend.first_name[0] ?? ''}${friend.last_name[0] ?? ''}`}
+                        text={`${friend?.first_name ? friend.first_name[0] : ''}${friend?.last_name ? friend.last_name[0] : ''}`}
                         flag={API_HOST + '/img/flags_new/' + friend.flag}
                         size={28}
                         borderColor={Colors.DARK_LIGHT}

+ 2 - 2
src/utils/request.ts

@@ -46,9 +46,9 @@ export const setupInterceptors = ({
         error.isTimeout = true;
         showBanner('Slow internet connection!');
         
-        return;
+        return Promise.reject(error);
       } else if (error.message === 'Network Error') {
-        return;
+        return Promise.reject(error);
       }
 
       showError(error.message, false);