mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #781 from omnivore-app/fix/update-page-result
Use the Article type instead of Page in updatePage API
This commit is contained in:
commit
ca51cddf2a
4 changed files with 19 additions and 21 deletions
|
|
@ -1177,9 +1177,9 @@ export type NewsletterEmailsSuccess = {
|
|||
|
||||
export type Page = {
|
||||
__typename?: 'Page';
|
||||
author: Scalars['String'];
|
||||
author?: Maybe<Scalars['String']>;
|
||||
createdAt: Scalars['Date'];
|
||||
description: Scalars['String'];
|
||||
description?: Maybe<Scalars['String']>;
|
||||
hash: Scalars['String'];
|
||||
id: Scalars['ID'];
|
||||
image: Scalars['String'];
|
||||
|
|
@ -2035,7 +2035,7 @@ export type UpdatePageResult = UpdatePageError | UpdatePageSuccess;
|
|||
|
||||
export type UpdatePageSuccess = {
|
||||
__typename?: 'UpdatePageSuccess';
|
||||
updatedPage: Page;
|
||||
updatedPage: Article;
|
||||
};
|
||||
|
||||
export type UpdateReminderError = {
|
||||
|
|
@ -3679,9 +3679,9 @@ export type NewsletterEmailsSuccessResolvers<ContextType = ResolverContext, Pare
|
|||
};
|
||||
|
||||
export type PageResolvers<ContextType = ResolverContext, ParentType extends ResolversParentTypes['Page'] = ResolversParentTypes['Page']> = {
|
||||
author?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
|
||||
author?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
||||
createdAt?: Resolver<ResolversTypes['Date'], ParentType, ContextType>;
|
||||
description?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
|
||||
description?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
||||
hash?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
|
||||
id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
|
||||
image?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
|
||||
|
|
@ -4166,7 +4166,7 @@ export type UpdatePageResultResolvers<ContextType = ResolverContext, ParentType
|
|||
};
|
||||
|
||||
export type UpdatePageSuccessResolvers<ContextType = ResolverContext, ParentType extends ResolversParentTypes['UpdatePageSuccess'] = ResolversParentTypes['UpdatePageSuccess']> = {
|
||||
updatedPage?: Resolver<ResolversTypes['Page'], ParentType, ContextType>;
|
||||
updatedPage?: Resolver<ResolversTypes['Article'], ParentType, ContextType>;
|
||||
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -831,9 +831,9 @@ type NewsletterEmailsSuccess {
|
|||
}
|
||||
|
||||
type Page {
|
||||
author: String!
|
||||
author: String
|
||||
createdAt: Date!
|
||||
description: String!
|
||||
description: String
|
||||
hash: String!
|
||||
id: ID!
|
||||
image: String!
|
||||
|
|
@ -1551,7 +1551,7 @@ input UpdatePageInput {
|
|||
union UpdatePageResult = UpdatePageError | UpdatePageSuccess
|
||||
|
||||
type UpdatePageSuccess {
|
||||
updatedPage: Page!
|
||||
updatedPage: Article!
|
||||
}
|
||||
|
||||
type UpdateReminderError {
|
||||
|
|
|
|||
|
|
@ -302,8 +302,8 @@ const schema = gql`
|
|||
type: PageType!
|
||||
image: String!
|
||||
title: String!
|
||||
author: String!
|
||||
description: String!
|
||||
author: String
|
||||
description: String
|
||||
publishedAt: Date
|
||||
|
||||
originalHtml: String!
|
||||
|
|
@ -514,7 +514,7 @@ const schema = gql`
|
|||
}
|
||||
|
||||
type UpdatePageSuccess {
|
||||
updatedPage: Page!
|
||||
updatedPage: Article!
|
||||
}
|
||||
|
||||
enum UpdatePageErrorCode {
|
||||
|
|
|
|||
|
|
@ -11,14 +11,10 @@ export async function updatePageMutation(
|
|||
input: UpdatePageInput
|
||||
): Promise<string | undefined> {
|
||||
const mutation = gql`
|
||||
mutation {
|
||||
updatePage(
|
||||
input: {
|
||||
pageId: "${input.pageId}"
|
||||
title: "${input.title}"
|
||||
description: "${input.description}"
|
||||
}
|
||||
) {
|
||||
mutation UpdatePage(
|
||||
$input: UpdatePageInput!
|
||||
) {
|
||||
updatePage(input: $input) {
|
||||
... on UpdatePageSuccess {
|
||||
updatedPage {
|
||||
id
|
||||
|
|
@ -39,7 +35,9 @@ export async function updatePageMutation(
|
|||
`
|
||||
|
||||
try {
|
||||
const data = await gqlFetcher(mutation)
|
||||
const data = await gqlFetcher(mutation, {
|
||||
input,
|
||||
})
|
||||
const output = data as any
|
||||
return output.updatePage
|
||||
} catch (err) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue