From 35d6c8463a2f4b9fc44a7b5e9f6605ec2691fbe0 Mon Sep 17 00:00:00 2001 From: Arnaud Babol Date: Wed, 10 Nov 2021 15:01:37 +0100 Subject: [PATCH] Need to make this clean --- package.json | 1 + pages/index.js | 44 ++++++++++++++++---------- src/components/BlockBlogPosts/index.js | 23 ++++++-------- src/components/BlogPost/index.js | 6 +--- yarn.lock | 12 +++++++ 5 files changed, 51 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index 5bc4aa0..e5ea1a5 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "author": "", "license": "ISC", "dependencies": { + "axios": "^0.24.0", "classnames": "^2.2.6", "jump.js": "^1.0.2", "next": "^10.0.4", diff --git a/pages/index.js b/pages/index.js index a77eba4..ba4ad54 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,5 +1,6 @@ import React from 'react'; import Head from 'next/head'; +import axios from 'axios'; import Header from '../src/components/Header'; import BlockBlogPosts from '../src/components/BlockBlogPosts'; @@ -16,26 +17,35 @@ const Home = ({ blogPosts }) => ( ); Home.getInitialProps = async () => { - const res = await fetch('https://medium.com/_/graphql', { + const data = JSON.stringify([ + { + operationName: 'ProfilePubHandlerQuery', + variables: { + id: null, + username: '@ababol', + homepagePostsLimit: 10, + includeDistributedResponses: true, + }, + query: + 'query ProfilePubHandlerQuery($id: ID, $username: ID, $homepagePostsLimit: PaginationLimit, $homepagePostsFrom: String, $includeDistributedResponses: Boolean) {\n userResult(id: $id, username: $username) {\n __typename\n ... on User {\n id\n name\n viewerIsUser\n viewerEdge {\n id\n isFollowing\n __typename\n }\n ...ProfilePubScreen_user\n ...EntityDrivenSubscriptionLandingPageScreen_writer\n ...useShouldShowEntityDrivenSubscription_creator\n __typename\n }\n }\n oneClickFollowEligibility(username: $username, userId: $id)\n}\n\nfragment ProfilePubScreen_user on User {\n id\n viewerIsUser\n customStyleSheet {\n id\n blogroll {\n visibility\n __typename\n }\n ...CustomBackgroundWrapper_customStyleSheet\n ...CustomThemeProvider_customStyleSheet\n ...MetaHeader_customStyleSheet\n ...PublisherSidebar_customStyleSheet\n __typename\n }\n ...MetaHeader_publisher\n ...PublisherHomepagePosts_publisher\n ...PublisherSidebar_user\n ...UserSubdomainFlow_user\n ...UserProfileMetadata_user\n ...SuspendedBannerLoader_user\n ...ExpandablePost_user\n __typename\n}\n\nfragment CustomBackgroundWrapper_customStyleSheet on CustomStyleSheet {\n id\n global {\n colorPalette {\n background {\n ...getHexFromColorValue_colorValue\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment getHexFromColorValue_colorValue on ColorValue {\n rgb\n alpha\n __typename\n}\n\nfragment CustomThemeProvider_customStyleSheet on CustomStyleSheet {\n id\n ...customDefaultBackgroundTheme_customStyleSheet\n ...customStyleSheetFontTheme_customStyleSheet\n __typename\n}\n\nfragment customDefaultBackgroundTheme_customStyleSheet on CustomStyleSheet {\n id\n global {\n colorPalette {\n primary {\n colorPalette {\n ...customDefaultBackgroundTheme_colorPalette\n __typename\n }\n __typename\n }\n background {\n colorPalette {\n ...customDefaultBackgroundTheme_colorPalette\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment customDefaultBackgroundTheme_colorPalette on ColorPalette {\n highlightSpectrum {\n ...ThemeUtil_colorSpectrum\n __typename\n }\n defaultBackgroundSpectrum {\n ...ThemeUtil_colorSpectrum\n __typename\n }\n tintBackgroundSpectrum {\n ...ThemeUtil_colorSpectrum\n __typename\n }\n __typename\n}\n\nfragment ThemeUtil_colorSpectrum on ColorSpectrum {\n backgroundColor\n ...ThemeUtilInterpolateHelpers_colorSpectrum\n __typename\n}\n\nfragment ThemeUtilInterpolateHelpers_colorSpectrum on ColorSpectrum {\n colorPoints {\n ...ThemeUtil_colorPoint\n __typename\n }\n __typename\n}\n\nfragment ThemeUtil_colorPoint on ColorPoint {\n color\n point\n __typename\n}\n\nfragment customStyleSheetFontTheme_customStyleSheet on CustomStyleSheet {\n id\n global {\n fonts {\n font1 {\n name\n __typename\n }\n font2 {\n name\n __typename\n }\n font3 {\n name\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment MetaHeader_customStyleSheet on CustomStyleSheet {\n id\n header {\n headerScale\n horizontalAlignment\n __typename\n }\n ...MetaHeaderBackground_customStyleSheet\n ...MetaHeaderEngagement_customStyleSheet\n ...MetaHeaderLogo_customStyleSheet\n ...MetaHeaderNavVertical_customStyleSheet\n ...MetaHeaderTagline_customStyleSheet\n ...MetaHeaderThemeProvider_customStyleSheet\n __typename\n}\n\nfragment MetaHeaderBackground_customStyleSheet on CustomStyleSheet {\n id\n header {\n headerScale\n backgroundImageDisplayMode\n backgroundImageVerticalAlignment\n backgroundColorDisplayMode\n backgroundColor {\n ...getHexFromColorValue_colorValue\n ...getOpaqueHexFromColorValue_colorValue\n __typename\n }\n secondaryBackgroundColor {\n ...getHexFromColorValue_colorValue\n __typename\n }\n postBackgroundColor {\n ...getHexFromColorValue_colorValue\n __typename\n }\n backgroundImage {\n ...MetaHeaderBackground_imageMetadata\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment MetaHeaderBackground_imageMetadata on ImageMetadata {\n id\n originalWidth\n __typename\n}\n\nfragment getOpaqueHexFromColorValue_colorValue on ColorValue {\n rgb\n __typename\n}\n\nfragment MetaHeaderEngagement_customStyleSheet on CustomStyleSheet {\n ...MetaHeaderNav_customStyleSheet\n __typename\n id\n}\n\nfragment MetaHeaderNav_customStyleSheet on CustomStyleSheet {\n id\n navigation {\n navItems {\n ...MetaHeaderNav_headerNavigationItem\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment MetaHeaderNav_headerNavigationItem on HeaderNavigationItem {\n name\n tagSlugs\n ...MetaHeaderNavLink_headerNavigationItem\n __typename\n}\n\nfragment MetaHeaderNavLink_headerNavigationItem on HeaderNavigationItem {\n name\n ...getNavItemHref_headerNavigationItem\n __typename\n}\n\nfragment getNavItemHref_headerNavigationItem on HeaderNavigationItem {\n href\n type\n tags {\n id\n normalizedTagSlug\n __typename\n }\n __typename\n}\n\nfragment MetaHeaderLogo_customStyleSheet on CustomStyleSheet {\n id\n header {\n nameColor {\n ...getHexFromColorValue_colorValue\n __typename\n }\n nameTreatment\n postNameTreatment\n logoImage {\n ...MetaHeaderLogo_imageMetadata\n __typename\n }\n logoScale\n __typename\n }\n __typename\n}\n\nfragment MetaHeaderLogo_imageMetadata on ImageMetadata {\n id\n originalWidth\n originalHeight\n ...PublisherLogo_image\n __typename\n}\n\nfragment PublisherLogo_image on ImageMetadata {\n id\n originalHeight\n originalWidth\n __typename\n}\n\nfragment MetaHeaderNavVertical_customStyleSheet on CustomStyleSheet {\n id\n navigation {\n navItems {\n ...MetaHeaderNavLink_headerNavigationItem\n __typename\n }\n __typename\n }\n ...MetaHeaderNav_customStyleSheet\n __typename\n}\n\nfragment MetaHeaderTagline_customStyleSheet on CustomStyleSheet {\n id\n header {\n taglineColor {\n ...getHexFromColorValue_colorValue\n __typename\n }\n taglineTreatment\n __typename\n }\n __typename\n}\n\nfragment MetaHeaderThemeProvider_customStyleSheet on CustomStyleSheet {\n id\n ...useMetaHeaderTheme_customStyleSheet\n __typename\n}\n\nfragment useMetaHeaderTheme_customStyleSheet on CustomStyleSheet {\n ...customDefaultBackgroundTheme_customStyleSheet\n global {\n colorPalette {\n primary {\n colorPalette {\n tintBackgroundSpectrum {\n ...ThemeUtil_colorSpectrum\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n header {\n backgroundColor {\n colorPalette {\n tintBackgroundSpectrum {\n ...ThemeUtil_colorSpectrum\n __typename\n }\n __typename\n }\n __typename\n }\n postBackgroundColor {\n colorPalette {\n tintBackgroundSpectrum {\n ...ThemeUtil_colorSpectrum\n __typename\n }\n __typename\n }\n __typename\n }\n backgroundImage {\n id\n __typename\n }\n __typename\n }\n __typename\n id\n}\n\nfragment MetaHeader_publisher on Publisher {\n __typename\n name\n ...MetaHeaderEngagement_publisher\n ...MetaHeaderLogo_publisher\n ...MetaHeaderNavVertical_publisher\n ...MetaHeaderTagline_publisher\n ...MetaHeaderThemeProvider_publisher\n ...MetaHeaderActions_publisher\n ...MetaHeaderTop_publisher\n ...MetaHeaderNavLink_publisher\n ... on Collection {\n id\n favicon {\n id\n __typename\n }\n tagline\n ...CollectionNavigationContextProvider_collection\n __typename\n }\n ... on User {\n id\n bio\n ...UserProfileCatalogsLink_publisher\n __typename\n }\n}\n\nfragment CollectionNavigationContextProvider_collection on Collection {\n id\n domain\n slug\n isAuroraVisible\n __typename\n}\n\nfragment MetaHeaderEngagement_publisher on Publisher {\n __typename\n ...MetaHeaderNav_publisher\n ...PublisherAboutLink_publisher\n ...PublisherFollowButton_publisher\n ...PublisherFollowerCount_publisher\n ...UserProfileBooksLink_publisher\n ... on Collection {\n creator {\n id\n __typename\n }\n customStyleSheet {\n id\n ...CustomThemeProvider_customStyleSheet\n __typename\n }\n __typename\n id\n }\n ... on User {\n ...UserProfileCatalogsLink_publisher\n ...UserSubscribeButton_user\n customStyleSheet {\n id\n ...CustomThemeProvider_customStyleSheet\n __typename\n }\n __typename\n id\n }\n}\n\nfragment MetaHeaderNav_publisher on Publisher {\n id\n ...MetaHeaderNavLink_publisher\n __typename\n}\n\nfragment MetaHeaderNavLink_publisher on Publisher {\n id\n ...getNavItemHref_publisher\n __typename\n}\n\nfragment getNavItemHref_publisher on Publisher {\n id\n ...publisherUrl_publisher\n __typename\n}\n\nfragment publisherUrl_publisher on Publisher {\n id\n __typename\n ... on Collection {\n ...collectionUrl_collection\n __typename\n id\n }\n ... on User {\n ...userUrl_user\n __typename\n id\n }\n}\n\nfragment collectionUrl_collection on Collection {\n id\n domain\n slug\n __typename\n}\n\nfragment userUrl_user on User {\n __typename\n id\n customDomainState {\n live {\n domain\n __typename\n }\n __typename\n }\n hasSubdomain\n username\n}\n\nfragment PublisherAboutLink_publisher on Publisher {\n __typename\n id\n ... on Collection {\n slug\n __typename\n id\n }\n ... on User {\n ...userUrl_user\n __typename\n id\n }\n}\n\nfragment PublisherFollowButton_publisher on Publisher {\n __typename\n ... on Collection {\n ...CollectionFollowButton_collection\n __typename\n id\n }\n ... on User {\n ...UserFollowButton_user\n __typename\n id\n }\n}\n\nfragment CollectionFollowButton_collection on Collection {\n __typename\n id\n name\n canToggleEmail\n slug\n ...collectionUrl_collection\n ...SusiClickable_collection\n}\n\nfragment SusiClickable_collection on Collection {\n ...SusiContainer_collection\n __typename\n id\n}\n\nfragment SusiContainer_collection on Collection {\n name\n ...SignInOptions_collection\n ...SignUpOptions_collection\n __typename\n id\n}\n\nfragment SignInOptions_collection on Collection {\n id\n name\n __typename\n}\n\nfragment SignUpOptions_collection on Collection {\n id\n name\n __typename\n}\n\nfragment UserFollowButton_user on User {\n ...UserFollowButtonSignedIn_user\n ...UserFollowButtonSignedOut_user\n __typename\n id\n}\n\nfragment UserFollowButtonSignedIn_user on User {\n id\n __typename\n}\n\nfragment UserFollowButtonSignedOut_user on User {\n id\n ...SusiClickable_user\n __typename\n}\n\nfragment SusiClickable_user on User {\n ...SusiContainer_user\n __typename\n id\n}\n\nfragment SusiContainer_user on User {\n ...SignInOptions_user\n ...SignUpOptions_user\n __typename\n id\n}\n\nfragment SignInOptions_user on User {\n id\n name\n __typename\n}\n\nfragment SignUpOptions_user on User {\n id\n name\n __typename\n}\n\nfragment PublisherFollowerCount_publisher on Publisher {\n __typename\n id\n ... on Collection {\n slug\n subscriberCount\n __typename\n id\n }\n ... on User {\n socialStats {\n followerCount\n __typename\n }\n username\n __typename\n id\n }\n}\n\nfragment UserProfileBooksLink_publisher on Publisher {\n __typename\n id\n ... on User {\n ...userUrl_user\n bookAuthor {\n ... on Author {\n id\n __typename\n }\n __typename\n id\n }\n __typename\n id\n }\n}\n\nfragment UserProfileCatalogsLink_publisher on Publisher {\n __typename\n id\n ... on User {\n ...userUrl_user\n homePostsPublished: homepagePostsConnection(paging: {limit: 1}) {\n posts {\n id\n __typename\n }\n __typename\n }\n __typename\n id\n }\n}\n\nfragment UserSubscribeButton_user on User {\n id\n isPartnerProgramEnrolled\n name\n viewerEdge {\n id\n isFollowing\n isUser\n __typename\n }\n viewerIsUser\n newsletterV3 {\n id\n ...useNewsletterV3Subscription_newsletterV3\n __typename\n }\n ...useNewsletterV3Subscription_user\n ...MembershipUpsellModal_user\n __typename\n}\n\nfragment useNewsletterV3Subscription_newsletterV3 on NewsletterV3 {\n id\n type\n slug\n name\n collection {\n slug\n __typename\n id\n }\n user {\n id\n name\n username\n newsletterV3 {\n id\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment useNewsletterV3Subscription_user on User {\n id\n username\n newsletterV3 {\n ...useNewsletterV3Subscription_newsletterV3\n __typename\n id\n }\n __typename\n}\n\nfragment MembershipUpsellModal_user on User {\n id\n name\n imageId\n postSubscribeMembershipUpsellShownAt\n newsletterV3 {\n id\n __typename\n }\n __typename\n}\n\nfragment MetaHeaderLogo_publisher on Publisher {\n __typename\n id\n name\n ... on Collection {\n logo {\n ...MetaHeaderLogo_imageMetadata\n ...PublisherLogo_image\n __typename\n id\n }\n __typename\n id\n }\n ...auroraHooks_publisher\n}\n\nfragment auroraHooks_publisher on Publisher {\n __typename\n ... on Collection {\n isAuroraEligible\n isAuroraVisible\n viewerEdge {\n id\n isEditor\n __typename\n }\n __typename\n id\n }\n ... on User {\n isAuroraVisible\n __typename\n id\n }\n}\n\nfragment MetaHeaderNavVertical_publisher on Publisher {\n id\n ...PublisherAboutLink_publisher\n ...MetaHeaderNav_publisher\n ...MetaHeaderNavLink_publisher\n __typename\n}\n\nfragment MetaHeaderTagline_publisher on Publisher {\n __typename\n ... on Collection {\n tagline\n __typename\n id\n }\n ... on User {\n bio\n __typename\n id\n }\n}\n\nfragment MetaHeaderThemeProvider_publisher on Publisher {\n __typename\n customStyleSheet {\n ...MetaHeaderThemeProvider_customStyleSheet\n __typename\n id\n }\n ... on Collection {\n colorPalette {\n ...customDefaultBackgroundTheme_colorPalette\n __typename\n }\n __typename\n id\n }\n}\n\nfragment MetaHeaderActions_publisher on Publisher {\n __typename\n ...MetaHeaderPubMenu_publisher\n ...SearchWidget_publisher\n ... on Collection {\n id\n creator {\n id\n __typename\n }\n customStyleSheet {\n navigation {\n navItems {\n name\n __typename\n }\n __typename\n }\n __typename\n id\n }\n ...CollectionAvatar_collection\n ...CollectionMetabarActionsPopover_collection\n ...MetaHeaderActions_collection_common\n __typename\n }\n ... on User {\n id\n ...UserAvatar_user\n __typename\n }\n}\n\nfragment MetaHeaderPubMenu_publisher on Publisher {\n __typename\n ... on Collection {\n id\n slug\n name\n domain\n newsletterV3 {\n slug\n __typename\n id\n }\n ...MutePopoverOptions_collection\n __typename\n }\n ... on User {\n id\n username\n ...MutePopoverOptions_creator\n __typename\n }\n}\n\nfragment MutePopoverOptions_collection on Collection {\n id\n __typename\n}\n\nfragment MutePopoverOptions_creator on User {\n id\n __typename\n}\n\nfragment SearchWidget_publisher on Publisher {\n __typename\n ... on Collection {\n id\n slug\n name\n domain\n __typename\n }\n ... on User {\n id\n name\n __typename\n }\n ...algoliaSearch_publisher\n}\n\nfragment algoliaSearch_publisher on Publisher {\n __typename\n id\n}\n\nfragment CollectionAvatar_collection on Collection {\n name\n avatar {\n id\n __typename\n }\n ...collectionUrl_collection\n __typename\n id\n}\n\nfragment CollectionMetabarActionsPopover_collection on Collection {\n id\n slug\n isAuroraEligible\n isAuroraVisible\n newsletterV3 {\n id\n slug\n __typename\n }\n ...collectionUrl_collection\n __typename\n}\n\nfragment MetaHeaderActions_collection_common on Collection {\n creator {\n id\n __typename\n }\n __typename\n id\n}\n\nfragment UserAvatar_user on User {\n __typename\n id\n imageId\n mediumMemberAt\n name\n username\n ...userUrl_user\n}\n\nfragment MetaHeaderTop_publisher on Publisher {\n __typename\n ... on Collection {\n slug\n ...CollectionMetabarActionsPopover_collection\n ...CollectionAvatar_collection\n ...MetaHeaderTop_collection\n __typename\n id\n }\n ... on User {\n username\n id\n __typename\n }\n}\n\nfragment MetaHeaderTop_collection on Collection {\n id\n creator {\n id\n __typename\n }\n __typename\n}\n\nfragment PublisherHomepagePosts_publisher on Publisher {\n __typename\n id\n homepagePostsConnection(\n paging: {limit: $homepagePostsLimit, from: $homepagePostsFrom}\n includeDistributedResponses: $includeDistributedResponses\n ) {\n posts {\n id\n collection {\n id\n name\n ...collectionUrl_collection\n __typename\n }\n creator {\n ...useShouldShowEntityDrivenSubscription_creator\n __typename\n }\n ...PostPresentationTracker_post\n ...ExpandablePost_post\n __typename\n }\n pagingInfo {\n next {\n from\n limit\n __typename\n }\n __typename\n }\n __typename\n }\n ...CardByline_publisher\n ...NewsletterV3Promo_publisher\n ...useShowAuthorNewsletterV3Promo_user\n}\n\nfragment useShouldShowEntityDrivenSubscription_creator on User {\n id\n __typename\n}\n\nfragment PostPresentationTracker_post on Post {\n id\n visibility\n previewContent {\n isFullContent\n __typename\n }\n collection {\n id\n slug\n __typename\n }\n __typename\n}\n\nfragment ExpandablePost_post on Post {\n id\n creator {\n ...ExpandablePost_user\n __typename\n id\n }\n collection {\n ...CardByline_collection\n __typename\n id\n }\n ...InteractivePostBody_postPreview\n firstPublishedAt\n isLocked\n isSeries\n isShortform\n latestPublishedAt\n mediumUrl\n postResponses {\n count\n __typename\n }\n previewContent {\n subtitle\n __typename\n }\n previewImage {\n id\n focusPercentX\n focusPercentY\n __typename\n }\n readingTime\n sequence {\n slug\n __typename\n }\n title\n uniqueSlug\n visibility\n inResponseToPostResult {\n ...InResponseToEntityPreview_postResult\n __typename\n }\n inResponseToCatalogResult {\n ...InResponseToEntityPreview_catalogResult\n __typename\n }\n ...CardByline_post\n ...ExpandablePostFooter_post\n ...PostPresentationTracker_post\n ...PostScrollTracker_post\n ...InResponseToEntityPreview_mediaResource\n ...ReadMore_post\n ...HighDensityPreview_post\n __typename\n}\n\nfragment ExpandablePost_user on User {\n __typename\n name\n username\n ...CardByline_user\n id\n}\n\nfragment CardByline_user on User {\n __typename\n id\n name\n username\n mediumMemberAt\n socialStats {\n followerCount\n __typename\n }\n ...userUrl_user\n ...UserMentionTooltip_user\n}\n\nfragment UserMentionTooltip_user on User {\n id\n name\n username\n bio\n imageId\n mediumMemberAt\n ...UserAvatar_user\n ...UserFollowButton_user\n __typename\n}\n\nfragment CardByline_collection on Collection {\n __typename\n id\n name\n ...collectionUrl_collection\n}\n\nfragment InteractivePostBody_postPreview on Post {\n extendedPreviewContent(\n truncationConfig: {previewParagraphsWordCountThreshold: 400, minimumWordLengthForTruncation: 150, truncateAtEndOfSentence: true, showFullImageCaptions: true, shortformPreviewParagraphsWordCountThreshold: 30, shortformMinimumWordLengthForTruncation: 30}\n ) {\n bodyModel {\n ...PostBody_bodyModel\n __typename\n }\n isFullContent\n __typename\n }\n __typename\n id\n}\n\nfragment PostBody_bodyModel on RichText {\n sections {\n name\n startIndex\n textLayout\n imageLayout\n backgroundImage {\n id\n originalHeight\n originalWidth\n __typename\n }\n videoLayout\n backgroundVideo {\n videoId\n originalHeight\n originalWidth\n previewImageId\n __typename\n }\n __typename\n }\n paragraphs {\n id\n ...PostBodySection_paragraph\n __typename\n }\n ...normalizedBodyModel_richText\n __typename\n}\n\nfragment PostBodySection_paragraph on Paragraph {\n name\n ...PostBodyParagraph_paragraph\n __typename\n id\n}\n\nfragment PostBodyParagraph_paragraph on Paragraph {\n name\n type\n ...ImageParagraph_paragraph\n ...TextParagraph_paragraph\n ...IframeParagraph_paragraph\n ...MixtapeParagraph_paragraph\n __typename\n id\n}\n\nfragment ImageParagraph_paragraph on Paragraph {\n href\n layout\n metadata {\n id\n originalHeight\n originalWidth\n focusPercentX\n focusPercentY\n alt\n __typename\n }\n ...Markups_paragraph\n ...ParagraphRefsMapContext_paragraph\n ...PostAnnotationsMarker_paragraph\n __typename\n id\n}\n\nfragment Markups_paragraph on Paragraph {\n name\n text\n hasDropCap\n dropCapImage {\n ...MarkupNode_data_dropCapImage\n __typename\n id\n }\n markups {\n type\n start\n end\n href\n anchorType\n userId\n linkMetadata {\n httpStatus\n __typename\n }\n __typename\n }\n __typename\n id\n}\n\nfragment MarkupNode_data_dropCapImage on ImageMetadata {\n ...DropCap_image\n __typename\n id\n}\n\nfragment DropCap_image on ImageMetadata {\n id\n originalHeight\n originalWidth\n __typename\n}\n\nfragment ParagraphRefsMapContext_paragraph on Paragraph {\n id\n name\n text\n __typename\n}\n\nfragment PostAnnotationsMarker_paragraph on Paragraph {\n ...PostViewNoteCard_paragraph\n __typename\n id\n}\n\nfragment PostViewNoteCard_paragraph on Paragraph {\n name\n __typename\n id\n}\n\nfragment TextParagraph_paragraph on Paragraph {\n type\n hasDropCap\n ...Markups_paragraph\n ...ParagraphRefsMapContext_paragraph\n __typename\n id\n}\n\nfragment IframeParagraph_paragraph on Paragraph {\n iframe {\n mediaResource {\n id\n iframeSrc\n iframeHeight\n iframeWidth\n title\n __typename\n }\n __typename\n }\n layout\n ...getEmbedlyCardUrlParams_paragraph\n ...Markups_paragraph\n __typename\n id\n}\n\nfragment getEmbedlyCardUrlParams_paragraph on Paragraph {\n type\n iframe {\n mediaResource {\n iframeSrc\n __typename\n }\n __typename\n }\n __typename\n id\n}\n\nfragment MixtapeParagraph_paragraph on Paragraph {\n text\n type\n mixtapeMetadata {\n href\n thumbnailImageId\n __typename\n }\n markups {\n start\n end\n type\n href\n __typename\n }\n __typename\n id\n}\n\nfragment normalizedBodyModel_richText on RichText {\n paragraphs {\n markups {\n type\n __typename\n }\n ...getParagraphHighlights_paragraph\n ...getParagraphPrivateNotes_paragraph\n __typename\n }\n sections {\n startIndex\n ...getSectionEndIndex_section\n __typename\n }\n ...getParagraphStyles_richText\n ...getParagraphSpaces_richText\n __typename\n}\n\nfragment getParagraphHighlights_paragraph on Paragraph {\n name\n __typename\n id\n}\n\nfragment getParagraphPrivateNotes_paragraph on Paragraph {\n name\n __typename\n id\n}\n\nfragment getSectionEndIndex_section on Section {\n startIndex\n __typename\n}\n\nfragment getParagraphStyles_richText on RichText {\n paragraphs {\n text\n type\n __typename\n }\n sections {\n ...getSectionEndIndex_section\n __typename\n }\n __typename\n}\n\nfragment getParagraphSpaces_richText on RichText {\n paragraphs {\n layout\n metadata {\n originalHeight\n originalWidth\n __typename\n }\n type\n ...paragraphExtendsImageGrid_paragraph\n __typename\n }\n ...getSeriesParagraphTopSpacings_richText\n ...getPostParagraphTopSpacings_richText\n __typename\n}\n\nfragment paragraphExtendsImageGrid_paragraph on Paragraph {\n layout\n type\n __typename\n id\n}\n\nfragment getSeriesParagraphTopSpacings_richText on RichText {\n paragraphs {\n id\n __typename\n }\n sections {\n startIndex\n __typename\n }\n __typename\n}\n\nfragment getPostParagraphTopSpacings_richText on RichText {\n paragraphs {\n layout\n text\n __typename\n }\n sections {\n startIndex\n __typename\n }\n __typename\n}\n\nfragment InResponseToEntityPreview_postResult on PostResult {\n ...InResponseToPostPreview_postResult\n __typename\n}\n\nfragment InResponseToPostPreview_postResult on PostResult {\n __typename\n ... on Post {\n id\n title\n mediumUrl\n creator {\n id\n name\n __typename\n }\n clapCount\n responsesCount\n visibility\n __typename\n }\n}\n\nfragment InResponseToEntityPreview_catalogResult on CatalogResult {\n ...InResponseToCatalogPreview_catalogResult\n __typename\n}\n\nfragment InResponseToCatalogPreview_catalogResult on CatalogResult {\n __typename\n ... on Catalog {\n id\n visibility\n creator {\n id\n __typename\n }\n ...CatalogsListItem_catalog\n __typename\n }\n}\n\nfragment CatalogsListItem_catalog on Catalog {\n id\n name\n predefined\n visibility\n ...catalogUrl_catalog\n ...formatItemsCount_catalog\n ...CatalogsListItemCovers_catalog\n __typename\n}\n\nfragment catalogUrl_catalog on Catalog {\n id\n predefined\n ...getCatalogSlugId_Catalog\n creator {\n ...userUrl_user\n __typename\n id\n }\n __typename\n}\n\nfragment getCatalogSlugId_Catalog on Catalog {\n id\n name\n __typename\n}\n\nfragment formatItemsCount_catalog on Catalog {\n postItemsCount\n bookEditionItemsCount\n __typename\n id\n}\n\nfragment CatalogsListItemCovers_catalog on Catalog {\n listItemsConnection: itemsConnection(pagingOptions: {limit: 10}) {\n items {\n catalogItemId\n ...CatalogCovers_catalogItemV2\n __typename\n }\n __typename\n }\n __typename\n id\n}\n\nfragment CatalogCovers_catalogItemV2 on CatalogItemV2 {\n catalogItemId\n entity {\n __typename\n ... on BookEdition {\n ...BookCover_bookEdition\n __typename\n id\n }\n ... on Post {\n previewImage {\n id\n alt\n __typename\n }\n __typename\n id\n }\n }\n __typename\n}\n\nfragment BookCover_bookEdition on BookEdition {\n cover\n book {\n ...bookProfileUrl_book\n __typename\n id\n }\n ...bookProfileUrl_bookEdition\n __typename\n id\n}\n\nfragment bookProfileUrl_book on Book {\n slug\n __typename\n id\n}\n\nfragment bookProfileUrl_bookEdition on BookEdition {\n format\n __typename\n id\n}\n\nfragment CardByline_post on Post {\n ...DraftStatus_post\n __typename\n id\n}\n\nfragment DraftStatus_post on Post {\n id\n pendingCollection {\n id\n creator {\n id\n __typename\n }\n ...BoldCollectionName_collection\n __typename\n }\n statusForCollection\n creator {\n id\n __typename\n }\n isPublished\n __typename\n}\n\nfragment BoldCollectionName_collection on Collection {\n id\n name\n __typename\n}\n\nfragment ExpandablePostFooter_post on Post {\n id\n allowResponses\n postResponses {\n count\n __typename\n }\n isLimitedState\n ...ExpandablePostCardOverflowButton_post\n ...BookmarkButton_post\n ...PostFooterSocialPopover_post\n ...MultiVote_post\n __typename\n}\n\nfragment ExpandablePostCardOverflowButton_post on Post {\n creator {\n id\n __typename\n }\n ...ExpandablePostCardEditorWriterButton_post\n ...ExpandablePostCardReaderButton_post\n __typename\n id\n}\n\nfragment ExpandablePostCardEditorWriterButton_post on Post {\n id\n collection {\n id\n name\n slug\n __typename\n }\n allowResponses\n clapCount\n visibility\n mediumUrl\n responseDistribution\n ...useIsPinnedInContext_post\n ...CopyFriendLinkMenuItem_post\n ...ClapMutation_post\n ...NewsletterV3EmailToSubscribersMenuItem_post\n __typename\n}\n\nfragment useIsPinnedInContext_post on Post {\n id\n collection {\n id\n __typename\n }\n pendingCollection {\n id\n __typename\n }\n pinnedAt\n pinnedByCreatorAt\n __typename\n}\n\nfragment CopyFriendLinkMenuItem_post on Post {\n id\n __typename\n}\n\nfragment ClapMutation_post on Post {\n __typename\n id\n clapCount\n ...MultiVoteCount_post\n}\n\nfragment MultiVoteCount_post on Post {\n id\n ...PostVotersNetwork_post\n __typename\n}\n\nfragment PostVotersNetwork_post on Post {\n id\n voterCount\n recommenders {\n name\n __typename\n }\n __typename\n}\n\nfragment NewsletterV3EmailToSubscribersMenuItem_post on Post {\n id\n creator {\n id\n newsletterV3 {\n id\n subscribersCount\n __typename\n }\n __typename\n }\n isPublishToEmail\n isNewsletter\n __typename\n}\n\nfragment ExpandablePostCardReaderButton_post on Post {\n id\n collection {\n id\n __typename\n }\n creator {\n id\n __typename\n }\n clapCount\n ...ClapMutation_post\n __typename\n}\n\nfragment BookmarkButton_post on Post {\n visibility\n ...SusiClickable_post\n ...AddToCatalogBookmarkButton_post\n __typename\n id\n}\n\nfragment SusiClickable_post on Post {\n id\n mediumUrl\n ...SusiContainer_post\n __typename\n}\n\nfragment SusiContainer_post on Post {\n id\n __typename\n}\n\nfragment AddToCatalogBookmarkButton_post on Post {\n ...AddToCatalogBase_post\n __typename\n id\n}\n\nfragment AddToCatalogBase_post on Post {\n id\n viewerEdge {\n catalogsConnection {\n catalogsContainingThis(type: LISTS) {\n catalogId\n catalogItemIds\n __typename\n }\n predefinedContainingThis {\n catalogId\n predefined\n catalogItemIds\n __typename\n }\n __typename\n }\n ...editCatalogItemsMutation_postViewerEdge\n ...useAddItemToPredefinedCatalog_postViewerEdge\n __typename\n id\n }\n ...WithToggleInsideCatalog_post\n __typename\n}\n\nfragment editCatalogItemsMutation_postViewerEdge on PostViewerEdge {\n id\n catalogsConnection {\n catalogsContainingThis(type: LISTS) {\n catalogId\n version\n catalogItemIds\n __typename\n }\n predefinedContainingThis {\n catalogId\n predefined\n version\n catalogItemIds\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment useAddItemToPredefinedCatalog_postViewerEdge on PostViewerEdge {\n id\n catalogsConnection {\n predefinedContainingThis {\n catalogId\n version\n predefined\n catalogItemIds\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment WithToggleInsideCatalog_post on Post {\n id\n viewerEdge {\n catalogsConnection {\n catalogsContainingThis(type: LISTS) {\n catalogId\n __typename\n }\n predefinedContainingThis {\n predefined\n __typename\n }\n __typename\n }\n __typename\n id\n }\n __typename\n}\n\nfragment PostFooterSocialPopover_post on Post {\n id\n mediumUrl\n title\n ...SharePostButton_post\n __typename\n}\n\nfragment SharePostButton_post on Post {\n id\n __typename\n}\n\nfragment MultiVote_post on Post {\n id\n clapCount\n creator {\n id\n ...SusiClickable_user\n __typename\n }\n isPublished\n ...SusiClickable_post\n collection {\n id\n slug\n __typename\n }\n isLimitedState\n ...MultiVoteCount_post\n __typename\n}\n\nfragment PostScrollTracker_post on Post {\n id\n collection {\n id\n __typename\n }\n sequence {\n sequenceId\n __typename\n }\n __typename\n}\n\nfragment InResponseToEntityPreview_mediaResource on Post {\n ...InResponseToPostPreview_mediaResource\n __typename\n id\n}\n\nfragment InResponseToPostPreview_mediaResource on Post {\n inResponseToMediaResource {\n mediumQuote {\n ...Quote_quote\n __typename\n id\n }\n __typename\n id\n }\n __typename\n id\n}\n\nfragment Quote_quote on Quote {\n quoteId\n userId\n post {\n id\n title\n mediumUrl\n creator {\n id\n username\n name\n ...userUrl_user\n __typename\n }\n __typename\n }\n startOffset\n endOffset\n paragraphs {\n text\n type\n markups {\n anchorType\n end\n href\n rel\n start\n title\n type\n userId\n __typename\n }\n ...TextParagraph_paragraph\n __typename\n }\n ...buildQuotePreviewParagraph_quote\n __typename\n id\n}\n\nfragment buildQuotePreviewParagraph_quote on Quote {\n paragraphs {\n id\n text\n type\n markups {\n end\n start\n type\n __typename\n }\n __typename\n }\n startOffset\n endOffset\n __typename\n id\n}\n\nfragment ReadMore_post on Post {\n mediumUrl\n readingTime\n ...usePostUrl_post\n __typename\n id\n}\n\nfragment usePostUrl_post on Post {\n id\n creator {\n id\n customDomainState {\n live {\n domain\n __typename\n }\n __typename\n }\n hasSubdomain\n username\n __typename\n }\n collection {\n id\n domain\n slug\n __typename\n }\n isSeries\n mediumUrl\n sequence {\n slug\n __typename\n }\n uniqueSlug\n __typename\n}\n\nfragment HighDensityPreview_post on Post {\n id\n title\n previewContent {\n subtitle\n __typename\n }\n previewImage {\n id\n __typename\n }\n ...HighDensityFooter_post\n __typename\n}\n\nfragment HighDensityFooter_post on Post {\n id\n readingTime\n tags {\n ...TopicPill_tag\n __typename\n }\n ...BookmarkButton_post\n ...ExpandablePostCardOverflowButton_post\n __typename\n}\n\nfragment TopicPill_tag on Tag {\n __typename\n id\n displayTitle\n}\n\nfragment CardByline_publisher on Publisher {\n __typename\n ... on User {\n id\n ...CardByline_user\n __typename\n }\n ... on Collection {\n id\n ...CardByline_collection\n __typename\n }\n}\n\nfragment NewsletterV3Promo_publisher on Publisher {\n __typename\n ... on User {\n ...NewsletterV3Promo_publisher_User\n __typename\n id\n }\n ... on Collection {\n ...NewsletterV3Promo_publisher_Collection\n __typename\n id\n }\n}\n\nfragment NewsletterV3Promo_publisher_User on User {\n id\n username\n name\n viewerIsUser\n newsletterV3 {\n id\n ...NewsletterV3Promo_newsletterV3\n __typename\n }\n __typename\n}\n\nfragment NewsletterV3Promo_newsletterV3 on NewsletterV3 {\n slug\n name\n description\n promoHeadline\n promoBody\n ...NewsletterV3AmpButton_newsletterV3\n ...NewsletterV3SubscribeButton_newsletterV3\n ...NewsletterV3SubscribeByEmail_newsletterV3\n __typename\n id\n}\n\nfragment NewsletterV3AmpButton_newsletterV3 on NewsletterV3 {\n id\n collection {\n ...collectionDefaultBackgroundTheme_collection\n __typename\n id\n }\n __typename\n}\n\nfragment collectionDefaultBackgroundTheme_collection on Collection {\n colorPalette {\n ...collectionDefaultBackgroundTheme_colorPalette\n __typename\n }\n customStyleSheet {\n id\n ...collectionDefaultBackgroundTheme_customStyleSheet\n __typename\n }\n __typename\n id\n}\n\nfragment collectionDefaultBackgroundTheme_colorPalette on ColorPalette {\n ...customDefaultBackgroundTheme_colorPalette\n __typename\n}\n\nfragment collectionDefaultBackgroundTheme_customStyleSheet on CustomStyleSheet {\n id\n ...customDefaultBackgroundTheme_customStyleSheet\n __typename\n}\n\nfragment NewsletterV3SubscribeButton_newsletterV3 on NewsletterV3 {\n id\n name\n slug\n type\n user {\n id\n name\n username\n __typename\n }\n collection {\n slug\n ...SusiClickable_collection\n ...collectionDefaultBackgroundTheme_collection\n __typename\n id\n }\n ...SusiClickable_newsletterV3\n ...useNewsletterV3Subscription_newsletterV3\n __typename\n}\n\nfragment SusiClickable_newsletterV3 on NewsletterV3 {\n ...SusiContainer_newsletterV3\n __typename\n id\n}\n\nfragment SusiContainer_newsletterV3 on NewsletterV3 {\n ...SignInOptions_newsletterV3\n ...SignUpOptions_newsletterV3\n __typename\n id\n}\n\nfragment SignInOptions_newsletterV3 on NewsletterV3 {\n id\n name\n __typename\n}\n\nfragment SignUpOptions_newsletterV3 on NewsletterV3 {\n id\n name\n __typename\n}\n\nfragment NewsletterV3SubscribeByEmail_newsletterV3 on NewsletterV3 {\n id\n slug\n type\n user {\n id\n name\n username\n __typename\n }\n collection {\n ...collectionDefaultBackgroundTheme_collection\n ...collectionUrl_collection\n __typename\n id\n }\n __typename\n}\n\nfragment NewsletterV3Promo_publisher_Collection on Collection {\n id\n slug\n domain\n name\n newsletterV3 {\n id\n ...NewsletterV3Promo_newsletterV3\n __typename\n }\n __typename\n}\n\nfragment useShowAuthorNewsletterV3Promo_user on User {\n id\n username\n newsletterV3 {\n id\n showPromo\n slug\n __typename\n }\n __typename\n}\n\nfragment PublisherSidebar_user on User {\n id\n username\n bio\n name\n imageId\n ...PublisherSidebarFollows_user\n ...SidebarProfilePic_user\n ...UserSubscribeButton_user\n __typename\n}\n\nfragment PublisherSidebarFollows_user on User {\n id\n name\n username\n ...PublisherFollowingCount_publisher\n ...userUrl_user\n __typename\n}\n\nfragment PublisherFollowingCount_publisher on Publisher {\n __typename\n id\n ... on User {\n socialStats {\n followingCount\n collectionFollowingCount\n __typename\n }\n followedCollections\n username\n __typename\n id\n }\n}\n\nfragment SidebarProfilePic_user on User {\n id\n imageId\n __typename\n}\n\nfragment PublisherSidebar_customStyleSheet on CustomStyleSheet {\n ...MetaHeader_customStyleSheet\n ...PublisherSidebarFollows_customStyleSheet\n __typename\n id\n}\n\nfragment PublisherSidebarFollows_customStyleSheet on CustomStyleSheet {\n id\n blogroll {\n visibility\n __typename\n }\n __typename\n}\n\nfragment UserSubdomainFlow_user on User {\n id\n hasCompletedProfile\n name\n bio\n imageId\n ...UserCompleteProfileDialog_user\n ...UserSubdomainOnboardingDialog_user\n __typename\n}\n\nfragment UserCompleteProfileDialog_user on User {\n id\n name\n bio\n imageId\n hasCompletedProfile\n __typename\n}\n\nfragment UserSubdomainOnboardingDialog_user on User {\n id\n customDomainState {\n pending {\n status\n __typename\n }\n live {\n status\n __typename\n }\n __typename\n }\n username\n __typename\n}\n\nfragment UserProfileMetadata_user on User {\n id\n username\n name\n bio\n socialStats {\n followerCount\n followingCount\n __typename\n }\n ...userUrl_user\n ...UserProfileMetadataHelmet_user\n __typename\n}\n\nfragment UserProfileMetadataHelmet_user on User {\n username\n name\n imageId\n twitterScreenName\n navItems {\n title\n __typename\n }\n __typename\n id\n}\n\nfragment SuspendedBannerLoader_user on User {\n id\n isSuspended\n __typename\n}\n\nfragment EntityDrivenSubscriptionLandingPageScreen_writer on User {\n name\n imageId\n id\n username\n isPartnerProgramEnrolled\n referredMembershipCustomHeadline\n referredMembershipCustomBody\n customStyleSheet {\n ...CustomThemeProvider_customStyleSheet\n ...CustomBackgroundWrapper_customStyleSheet\n ...MetaHeader_customStyleSheet\n __typename\n id\n }\n ...MetaHeader_publisher\n ...userUrl_user\n __typename\n}\n', + }, + ]); + + const config = { + method: 'post', + url: 'https://medium.com/_/graphql', headers: { - 'apollographql-client-version': 'master-20190924-185930-60bd7935da', 'content-type': 'application/json', - 'graphql-operation': 'UserProfileOverviewHandler', - 'medium-frontend-app': 'lite/master-20190924-185930-60bd7935da', - 'medium-frontend-route': 'profile', - 'sec-fetch-mode': 'cors', - 'sec-fetch-site': 'same-origin', + Cookie: + 'uid=lo_6fd2654b825b; sid=1%3AzPHQfkzN4CfFbTvA338IizZTWX9C0E6FXFrXgcfuLV1TbqycT8BeyQTEvoheG7Vo; optimizelyEndUserId=lo_6fd2654b825b; __cfruid=cc5be96151ab352b769334741402a6037fc4f681-1636551314', }, - referrer: 'https://medium.com/@ababol', - body: - '{"operationName":"UserProfileOverviewHandler","variables":{"username":"@ababol","paging":null},"query":"query UserProfileOverviewHandler($username: ID!, $paging: PagingOptions) {\\n userResult(username: $username) {\\n __typename\\n ... on User {\\n id\\n ...UserProfileScreen_user\\n profileStreamConnection(paging: $paging) {\\n ...commonStreamConnection\\n __typename\\n }\\n __typename\\n }\\n }\\n viewer {\\n ...PostActions_viewer\\n __typename\\n }\\n}\\n\\nfragment UserProfileScreen_user on User {\\n id\\n ...SuspendedBannerLoader_user\\n ...UserProfileHero_user\\n ...UserProfileNav_user\\n ...UserProfileMetadata_user\\n __typename\\n}\\n\\nfragment SuspendedBannerLoader_user on User {\\n id\\n isSuspended\\n __typename\\n}\\n\\nfragment UserProfileMetadata_user on User {\\n id\\n username\\n name\\n bio\\n imageId\\n facebookAccountId\\n twitterScreenName\\n __typename\\n}\\n\\nfragment UserProfileHero_user on User {\\n id\\n username\\n mediumMemberAt\\n name\\n bio\\n twitterScreenName\\n facebookAccountId\\n userMeta {\\n collections {\\n name\\n slug\\n id\\n __typename\\n }\\n topWriterInTags {\\n id\\n displayTitle\\n __typename\\n }\\n userSuggestionReason {\\n reason {\\n __typename\\n ... on FolloweesWhoFollow {\\n users {\\n name\\n username\\n __typename\\n }\\n __typename\\n }\\n }\\n __typename\\n }\\n __typename\\n }\\n socialStats {\\n followingCount\\n followerCount\\n __typename\\n }\\n ...UserAvatar_user\\n ...UserProfileActions_user\\n ...UserProfileSummary_user\\n __typename\\n}\\n\\nfragment UserAvatar_user on User {\\n username\\n id\\n name\\n imageId\\n mediumMemberAt\\n __typename\\n}\\n\\nfragment UserProfileActions_user on User {\\n id\\n username\\n isBlocking\\n ...UserFollowButton_user\\n __typename\\n}\\n\\nfragment UserFollowButton_user on User {\\n ...UserFollowButtonSignedIn_user\\n ...UserFollowButtonSignedOut_user\\n __typename\\n}\\n\\nfragment UserFollowButtonSignedIn_user on User {\\n id\\n isFollowing\\n __typename\\n}\\n\\nfragment UserFollowButtonSignedOut_user on User {\\n id\\n ...SusiClickable_user\\n __typename\\n}\\n\\nfragment SusiClickable_user on User {\\n ...SusiContainer_user\\n __typename\\n}\\n\\nfragment SusiContainer_user on User {\\n ...SignInContainer_user\\n ...SignUpOptions_user\\n __typename\\n}\\n\\nfragment SignInContainer_user on User {\\n ...SignInOptions_user\\n __typename\\n}\\n\\nfragment SignInOptions_user on User {\\n id\\n name\\n __typename\\n}\\n\\nfragment SignUpOptions_user on User {\\n id\\n name\\n __typename\\n}\\n\\nfragment UserProfileSummary_user on User {\\n id\\n mediumMemberAt\\n userMeta {\\n collections {\\n name\\n slug\\n id\\n ...collectionUrl_collection\\n __typename\\n }\\n topWriterInTags {\\n id\\n displayTitle\\n __typename\\n }\\n __typename\\n }\\n __typename\\n}\\n\\nfragment collectionUrl_collection on Collection {\\n id\\n domain\\n slug\\n __typename\\n}\\n\\nfragment UserProfileNav_user on User {\\n id\\n navItems {\\n title\\n href: url\\n __typename\\n }\\n __typename\\n}\\n\\nfragment commonStreamConnection on StreamConnection {\\n stream {\\n ...StreamItemList_streamItem\\n __typename\\n }\\n pagingInfo {\\n next {\\n limit\\n page\\n source\\n to\\n ignoredIds\\n __typename\\n }\\n __typename\\n }\\n __typename\\n}\\n\\nfragment StreamItemList_streamItem on StreamItem {\\n ...StreamItem_streamItem\\n __typename\\n}\\n\\nfragment StreamItem_streamItem on StreamItem {\\n itemType {\\n __typename\\n ... on StreamItemHeading {\\n ...StreamItemHeading_streamItemHeading\\n __typename\\n }\\n ... on StreamItemPostPreview {\\n ...StreamItemPostPreview_streamItemPostPreview\\n __typename\\n }\\n ... on StreamItemSeriesHeroCarousel {\\n ...StreamItemSeriesHeroCarousel_streamItemSeriesHeroCarousel\\n __typename\\n }\\n ... on StreamItemSeriesGridCard {\\n ...StreamItemSeriesGridCard_streamItemSeriesGridCard\\n __typename\\n }\\n ... on StreamItemQuotePreview {\\n ...StreamItemQuotePreview_streamItemQuotePreview\\n __typename\\n }\\n ... on StreamItemQuoteList {\\n ...StreamItemQuoteList_streamItemQuoteList\\n __typename\\n }\\n ... on StreamItemCompressedPostList {\\n ...StreamItemCompressedPostList_streamItemCompressedPostList\\n __typename\\n }\\n ... on StreamItemSequence {\\n ...StreamItemSequence_streamItemSequence\\n __typename\\n }\\n }\\n __typename\\n}\\n\\nfragment StreamItemHeading_streamItemHeading on StreamItemHeading {\\n text\\n heading {\\n ...Heading_heading\\n __typename\\n }\\n __typename\\n}\\n\\nfragment Heading_heading on Heading {\\n headingType {\\n __typename\\n ... on HeadingBasic {\\n title\\n __typename\\n }\\n ... on HeadingWithLink {\\n title\\n linkText\\n linkUrl\\n __typename\\n }\\n }\\n __typename\\n}\\n\\nfragment StreamItemPostPreview_streamItemPostPreview on StreamItemPostPreview {\\n post {\\n id\\n mediumUrl\\n previewContent {\\n bodyModel {\\n ...PostBody_bodyModel\\n __typename\\n }\\n __typename\\n }\\n inResponseToPostResult {\\n ...InResponseToPostPreview_postResult\\n __typename\\n }\\n isLocked\\n clapCount\\n responsesCount\\n ...PostActions_post\\n ...PostByline_post\\n ...PostPresentationTracker_post\\n ...BookmarkButton_post\\n ...MultiVote_post\\n __typename\\n }\\n postSuggestionReasons {\\n ...getFirstPostFeedReason_postSuggestionReason\\n __typename\\n }\\n __typename\\n}\\n\\nfragment InResponseToPostPreview_postResult on PostResult {\\n __typename\\n ... on Post {\\n id\\n title\\n mediumUrl\\n creator {\\n id\\n name\\n __typename\\n }\\n clapCount\\n responsesCount\\n __typename\\n }\\n}\\n\\nfragment PostActions_post on Post {\\n id\\n creator {\\n id\\n __typename\\n }\\n __typename\\n}\\n\\nfragment PostBody_bodyModel on RichText {\\n sections {\\n name\\n startIndex\\n textLayout\\n imageLayout\\n backgroundImage {\\n id\\n originalHeight\\n originalWidth\\n __typename\\n }\\n videoLayout\\n backgroundVideo {\\n videoId\\n originalHeight\\n originalWidth\\n previewImageId\\n __typename\\n }\\n __typename\\n }\\n paragraphs {\\n id\\n ...normalizedBodyModel_paragraph\\n ...PostBodySection_paragraphs\\n __typename\\n }\\n __typename\\n}\\n\\nfragment normalizedBodyModel_paragraph on Paragraph {\\n ...getParagraphHighlights_paragraph\\n ...getParagraphPrivateNotes_paragraph\\n __typename\\n}\\n\\nfragment getParagraphHighlights_paragraph on Paragraph {\\n name\\n __typename\\n}\\n\\nfragment getParagraphPrivateNotes_paragraph on Paragraph {\\n name\\n __typename\\n}\\n\\nfragment PostBodySection_paragraphs on Paragraph {\\n name\\n ...PostBodyParagraph_paragraph\\n __typename\\n}\\n\\nfragment PostBodyParagraph_paragraph on Paragraph {\\n name\\n type\\n ...ImageParagraph_paragraph\\n ...TextParagraph_paragraph\\n ...IframeParagraph_paragraph\\n ...MixtapeParagraph_paragraph\\n __typename\\n}\\n\\nfragment IframeParagraph_paragraph on Paragraph {\\n iframe {\\n mediaResource {\\n id\\n iframeSrc\\n iframeHeight\\n iframeWidth\\n title\\n __typename\\n }\\n __typename\\n }\\n layout\\n ...Markups_paragraph\\n __typename\\n}\\n\\nfragment Markups_paragraph on Paragraph {\\n name\\n text\\n hasDropCap\\n dropCapImage {\\n ...MarkupNode_data_dropCapImage\\n __typename\\n }\\n markups {\\n type\\n start\\n end\\n href\\n anchorType\\n userId\\n linkMetadata {\\n httpStatus\\n __typename\\n }\\n __typename\\n }\\n __typename\\n}\\n\\nfragment MarkupNode_data_dropCapImage on ImageMetadata {\\n ...DropCap_image\\n __typename\\n}\\n\\nfragment DropCap_image on ImageMetadata {\\n id\\n originalHeight\\n originalWidth\\n __typename\\n}\\n\\nfragment ImageParagraph_paragraph on Paragraph {\\n href\\n layout\\n metadata {\\n id\\n originalHeight\\n originalWidth\\n focusPercentX\\n focusPercentY\\n alt\\n __typename\\n }\\n ...InteractiveMarkups_paragraph\\n ...Markups_paragraph\\n ...PostAnnotationsMarker_paragraph\\n __typename\\n}\\n\\nfragment InteractiveMarkups_paragraph on Paragraph {\\n ...Markups_paragraph\\n __typename\\n}\\n\\nfragment PostAnnotationsMarker_paragraph on Paragraph {\\n ...PostViewNoteCard_paragraph\\n __typename\\n}\\n\\nfragment PostViewNoteCard_paragraph on Paragraph {\\n name\\n __typename\\n}\\n\\nfragment TextParagraph_paragraph on Paragraph {\\n type\\n hasDropCap\\n ...InteractiveMarkups_paragraph\\n ...Markups_paragraph\\n ...ParagraphRefsMapContext_paragraph\\n __typename\\n}\\n\\nfragment ParagraphRefsMapContext_paragraph on Paragraph {\\n name\\n text\\n __typename\\n}\\n\\nfragment MixtapeParagraph_paragraph on Paragraph {\\n text\\n type\\n mixtapeMetadata {\\n href\\n thumbnailImageId\\n mediaResourceId\\n __typename\\n }\\n markups {\\n start\\n end\\n type\\n href\\n __typename\\n }\\n __typename\\n}\\n\\nfragment PostByline_post on Post {\\n id\\n isPublished\\n mediumUrl\\n firstPublishedAt\\n readingTime\\n statusForCollection\\n isLocked\\n visibility\\n collection {\\n name\\n id\\n slug\\n ...collectionUrl_collection\\n __typename\\n }\\n creator {\\n name\\n username\\n id\\n bio\\n isFollowing\\n ...UserAvatar_user\\n __typename\\n }\\n __typename\\n}\\n\\nfragment PostPresentationTracker_post on Post {\\n id\\n visibility\\n previewContent {\\n isFullContent\\n __typename\\n }\\n collection {\\n id\\n __typename\\n }\\n __typename\\n}\\n\\nfragment BookmarkButton_post on Post {\\n ...SusiClickable_post\\n ...WithSetReadingList_post\\n __typename\\n}\\n\\nfragment SusiClickable_post on Post {\\n ...SusiContainer_post\\n __typename\\n}\\n\\nfragment SusiContainer_post on Post {\\n id\\n __typename\\n}\\n\\nfragment WithSetReadingList_post on Post {\\n ...ReadingList_post\\n __typename\\n}\\n\\nfragment ReadingList_post on Post {\\n id\\n readingList\\n __typename\\n}\\n\\nfragment MultiVote_post on Post {\\n id\\n clapCount\\n creator {\\n id\\n ...SusiClickable_user\\n __typename\\n }\\n viewerClapCount\\n isPublished\\n ...SusiClickable_post\\n collection {\\n id\\n slug\\n __typename\\n }\\n isLimitedState\\n ...MultiVoteCount_post\\n __typename\\n}\\n\\nfragment MultiVoteCount_post on Post {\\n id\\n ...PostVotersNetwork_post\\n __typename\\n}\\n\\nfragment PostVotersNetwork_post on Post {\\n voterCount\\n viewerClapCount\\n recommenders {\\n name\\n __typename\\n }\\n __typename\\n}\\n\\nfragment getFirstPostFeedReason_postSuggestionReason on PostSuggestionReason {\\n reason\\n __typename\\n}\\n\\nfragment StreamItemSeriesHeroCarousel_streamItemSeriesHeroCarousel on StreamItemSeriesHeroCarousel {\\n cards {\\n ...SeriesCarouselHeroCard_seriesCarouselHeroCard\\n __typename\\n }\\n __typename\\n}\\n\\nfragment SeriesCarouselHeroCard_seriesCarouselHeroCard on SeriesCarouselHeroCard {\\n post {\\n ...SeriesTitleCard_post\\n __typename\\n }\\n __typename\\n}\\n\\nfragment SeriesTitleCard_post on Post {\\n id\\n title\\n previewContent {\\n bodyModel {\\n paragraphs {\\n metadata {\\n id\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n __typename\\n}\\n\\nfragment StreamItemSeriesGridCard_streamItemSeriesGridCard on StreamItemSeriesGridCard {\\n post {\\n ...SeriesTitleCard_post\\n __typename\\n }\\n __typename\\n}\\n\\nfragment StreamItemQuotePreview_streamItemQuotePreview on StreamItemQuotePreview {\\n quote {\\n ...Quote_quote\\n __typename\\n }\\n __typename\\n}\\n\\nfragment Quote_quote on Quote {\\n quoteId\\n userId\\n post {\\n id\\n title\\n mediumUrl\\n creator {\\n id\\n username\\n name\\n __typename\\n }\\n __typename\\n }\\n startOffset\\n endOffset\\n paragraphs {\\n text\\n type\\n markups {\\n anchorType\\n end\\n href\\n rel\\n start\\n title\\n type\\n userId\\n __typename\\n }\\n ...TextParagraph_paragraph\\n __typename\\n }\\n __typename\\n}\\n\\nfragment StreamItemQuoteList_streamItemQuoteList on StreamItemQuoteList {\\n heading {\\n ...Heading_heading\\n __typename\\n }\\n items {\\n quote {\\n ...Quote_quote\\n __typename\\n }\\n __typename\\n }\\n __typename\\n}\\n\\nfragment StreamItemCompressedPostList_streamItemCompressedPostList on StreamItemCompressedPostList {\\n heading {\\n ...Heading_heading\\n __typename\\n }\\n items {\\n post {\\n id\\n title\\n mediumUrl\\n creator {\\n id\\n username\\n name\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n __typename\\n}\\n\\nfragment StreamItemSequence_streamItemSequence on StreamItemSequence {\\n sequence {\\n slug\\n eyebrow\\n title\\n subtitle\\n description\\n updatedAt\\n featuredUserTitle\\n featuredUserCustomBio\\n color\\n bgColor\\n hideIndex\\n postIds\\n ...SequenceCoverImage_sequence\\n __typename\\n }\\n __typename\\n}\\n\\nfragment SequenceCoverImage_sequence on Sequence {\\n title\\n coverImage {\\n id\\n __typename\\n }\\n __typename\\n}\\n\\nfragment PostActions_viewer on User {\\n id\\n username\\n userMeta {\\n featuredPostId\\n __typename\\n }\\n __typename\\n}\\n"}', - method: 'POST', - mode: 'cors', - }); - const json = await res.json(); - const { stream } = json.data.userResult.profileStreamConnection; - - return { blogPosts: stream.slice(1, stream.length) }; + data: data, + }; + + const response = await axios(config); + const body = response.data; + + return { blogPosts: body[0].data.userResult.homepagePostsConnection.posts }; }; export default Home; diff --git a/src/components/BlockBlogPosts/index.js b/src/components/BlockBlogPosts/index.js index ec41524..a494126 100644 --- a/src/components/BlockBlogPosts/index.js +++ b/src/components/BlockBlogPosts/index.js @@ -7,26 +7,23 @@ export default ({ posts }) => (