aboutsummaryrefslogtreecommitdiffstats
path: root/src/services
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-09-20 16:38:54 +0200
committerArmand Philippot <git@armandphilippot.com>2023-09-20 16:38:54 +0200
commitf861e6a269ba9f62700776d3cd13b644a9e836d4 (patch)
treea5a107e7a6e4ff8b4261fe04349357bc00b783ee /src/services
parent03331c44276ec56e9f235e4d5ee75030455a753f (diff)
refactor: use named export for everything except pages
Next expect a default export for pages so only those components should use default exports. Everything else should use named exports to reduce the number of import statements.
Diffstat (limited to 'src/services')
-rw-r--r--src/services/graphql/api.ts4
-rw-r--r--src/services/graphql/articles.ts23
-rw-r--r--src/services/graphql/comments.ts16
-rw-r--r--src/services/graphql/contact.ts2
-rw-r--r--src/services/graphql/index.ts12
-rw-r--r--src/services/graphql/thematics.ts22
-rw-r--r--src/services/graphql/topics.ts22
7 files changed, 61 insertions, 40 deletions
diff --git a/src/services/graphql/api.ts b/src/services/graphql/api.ts
index e7f6e57..5f32a78 100644
--- a/src/services/graphql/api.ts
+++ b/src/services/graphql/api.ts
@@ -2,12 +2,10 @@ import {
Mutations,
MutationsInputMap,
MutationsResponseMap,
-} from '../../types/graphql/mutations';
-import {
Queries,
QueriesInputMap,
QueriesResponseMap,
-} from '../../types/graphql/queries';
+} from '../../types';
import { settings } from '../../utils/config';
/**
diff --git a/src/services/graphql/articles.ts b/src/services/graphql/articles.ts
index 5f98fe9..789ef2b 100644
--- a/src/services/graphql/articles.ts
+++ b/src/services/graphql/articles.ts
@@ -1,17 +1,20 @@
-import { type Article, type ArticleCard, type Slug } from '../../types/app';
-import {
- GraphQLEdgesInput,
- GraphQLPageInfo,
-} from '../../types/graphql/generics';
-import { EdgesResponse, EndCursorResponse } from '../../types/graphql/queries';
import {
+ type Article,
+ type ArticleCard,
+ type EdgesResponse,
+ type EndCursorResponse,
+ type GraphQLEdgesInput,
+ type GraphQLPageInfo,
type RawArticle,
type RawArticlePreview,
+ type Slug,
type TotalItems,
-} from '../../types/raw-data';
-import { getAuthorFromRawData } from '../../utils/helpers/author';
-import { getImageFromRawData } from '../../utils/helpers/images';
-import { getPageLinkFromRawData } from '../../utils/helpers/pages';
+} from '../../types';
+import {
+ getAuthorFromRawData,
+ getImageFromRawData,
+ getPageLinkFromRawData,
+} from '../../utils/helpers';
import { fetchAPI } from './api';
import {
articleBySlugQuery,
diff --git a/src/services/graphql/comments.ts b/src/services/graphql/comments.ts
index 426a649..4eaeac7 100644
--- a/src/services/graphql/comments.ts
+++ b/src/services/graphql/comments.ts
@@ -1,9 +1,13 @@
-import { SingleComment } from '../../types/app';
-import { GraphQLEdgesInput } from '../../types/graphql/generics';
-import { SendCommentInput, SentComment } from '../../types/graphql/mutations';
-import { ContentId } from '../../types/graphql/queries';
-import { RawComment, RawCommentsPage } from '../../types/raw-data';
-import { getAuthorFromRawData } from '../../utils/helpers/author';
+import {
+ type ContentId,
+ type GraphQLEdgesInput,
+ type RawComment,
+ type RawCommentsPage,
+ type SendCommentInput,
+ type SentComment,
+ type SingleComment,
+} from '../../types';
+import { getAuthorFromRawData } from '../../utils/helpers';
import { fetchAPI } from './api';
import { sendCommentMutation } from './comments.mutation';
import { commentsQuery } from './comments.query';
diff --git a/src/services/graphql/contact.ts b/src/services/graphql/contact.ts
index 37c640d..3098374 100644
--- a/src/services/graphql/contact.ts
+++ b/src/services/graphql/contact.ts
@@ -1,4 +1,4 @@
-import { SendMailInput } from '../../types/graphql/mutations';
+import { SendMailInput } from '../../types';
import { fetchAPI } from './api';
import { sendMailMutation } from './contact.mutation';
diff --git a/src/services/graphql/index.ts b/src/services/graphql/index.ts
new file mode 100644
index 0000000..c1eac16
--- /dev/null
+++ b/src/services/graphql/index.ts
@@ -0,0 +1,12 @@
+export * from './api';
+export * from './articles';
+export * from './articles.query';
+export * from './comments';
+export * from './comments.mutation';
+export * from './comments.query';
+export * from './contact';
+export * from './contact.mutation';
+export * from './thematics';
+export * from './thematics.query';
+export * from './topics';
+export * from './topics.query';
diff --git a/src/services/graphql/thematics.ts b/src/services/graphql/thematics.ts
index 9210828..7a57824 100644
--- a/src/services/graphql/thematics.ts
+++ b/src/services/graphql/thematics.ts
@@ -1,17 +1,19 @@
-import { PageLink, Slug, Thematic } from '../../types/app';
-import { GraphQLEdgesInput } from '../../types/graphql/generics';
-import { EdgesResponse } from '../../types/graphql/queries';
import {
- RawArticle,
- RawThematic,
- RawThematicPreview,
- TotalItems,
-} from '../../types/raw-data';
-import { getImageFromRawData } from '../../utils/helpers/images';
+ type EdgesResponse,
+ type GraphQLEdgesInput,
+ type PageLink,
+ type RawArticle,
+ type RawThematic,
+ type RawThematicPreview,
+ type Slug,
+ type Thematic,
+ type TotalItems,
+} from '../../types';
import {
+ getImageFromRawData,
getPageLinkFromRawData,
sortPageLinksByName,
-} from '../../utils/helpers/pages';
+} from '../../utils/helpers';
import { fetchAPI } from './api';
import { getArticleFromRawData } from './articles';
import {
diff --git a/src/services/graphql/topics.ts b/src/services/graphql/topics.ts
index 4c2f609..921b10d 100644
--- a/src/services/graphql/topics.ts
+++ b/src/services/graphql/topics.ts
@@ -1,17 +1,19 @@
-import { PageLink, Slug, Topic } from '../../types/app';
-import { GraphQLEdgesInput } from '../../types/graphql/generics';
-import { EdgesResponse } from '../../types/graphql/queries';
import {
- RawArticle,
- RawTopic,
- RawTopicPreview,
- TotalItems,
-} from '../../types/raw-data';
-import { getImageFromRawData } from '../../utils/helpers/images';
+ type EdgesResponse,
+ type GraphQLEdgesInput,
+ type PageLink,
+ type RawArticle,
+ type RawTopic,
+ type RawTopicPreview,
+ type Slug,
+ type Topic,
+ type TotalItems,
+} from '../../types';
import {
+ getImageFromRawData,
getPageLinkFromRawData,
sortPageLinksByName,
-} from '../../utils/helpers/pages';
+} from '../../utils/helpers';
import { fetchAPI } from './api';
import { getArticleFromRawData } from './articles';
import {