common-result-api
This commit is contained in:
parent
62250ba239
commit
bdd044524d
|
@ -33,7 +33,7 @@ export const ProfileFormProvider = (props: { children: JSX.Element }) => {
|
||||||
const [form, setForm] = createStore<ProfileInput>({})
|
const [form, setForm] = createStore<ProfileInput>({})
|
||||||
|
|
||||||
const submit = async (profile: ProfileInput) => {
|
const submit = async (profile: ProfileInput) => {
|
||||||
const response = await apiClient.updateProfile(profile)
|
const response = await apiClient.updateAuthor(profile)
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
console.error(response.error)
|
console.error(response.error)
|
||||||
throw response.error
|
throw response.error
|
||||||
|
|
|
@ -8,7 +8,7 @@ import type {
|
||||||
ReactionInput,
|
ReactionInput,
|
||||||
ReactionBy,
|
ReactionBy,
|
||||||
Shout,
|
Shout,
|
||||||
Result,
|
CommonResult,
|
||||||
QueryLoad_Authors_ByArgs,
|
QueryLoad_Authors_ByArgs,
|
||||||
QueryLoad_Shouts_SearchArgs,
|
QueryLoad_Shouts_SearchArgs,
|
||||||
QueryLoad_Shouts_Random_TopArgs,
|
QueryLoad_Shouts_Random_TopArgs,
|
||||||
|
@ -26,7 +26,7 @@ import reactionCreate from '../mutation/core/reaction-create'
|
||||||
import reactionDestroy from '../mutation/core/reaction-destroy'
|
import reactionDestroy from '../mutation/core/reaction-destroy'
|
||||||
import reactionUpdate from '../mutation/core/reaction-update'
|
import reactionUpdate from '../mutation/core/reaction-update'
|
||||||
import unfollowMutation from '../mutation/core/unfollow'
|
import unfollowMutation from '../mutation/core/unfollow'
|
||||||
import updateProfile from '../mutation/core/update-profile'
|
import updateAuthor from '../mutation/core/author-update'
|
||||||
import shoutLoad from '../query/core/article-load'
|
import shoutLoad from '../query/core/article-load'
|
||||||
import shoutsLoadBy from '../query/core/articles-load-by'
|
import shoutsLoadBy from '../query/core/articles-load-by'
|
||||||
import draftsLoad from '../query/core/articles-load-drafts'
|
import draftsLoad from '../query/core/articles-load-drafts'
|
||||||
|
@ -137,9 +137,9 @@ export const apiClient = {
|
||||||
const response = await publicGraphQLClient.query(authorFollowedCommunities, { slug }).toPromise()
|
const response = await publicGraphQLClient.query(authorFollowedCommunities, { slug }).toPromise()
|
||||||
return response.data.get_communities_by_author
|
return response.data.get_communities_by_author
|
||||||
},
|
},
|
||||||
updateProfile: async (input: ProfileInput) => {
|
updateAuthor: async (input: ProfileInput) => {
|
||||||
const response = await apiClient.private.mutation(updateProfile, { profile: input }).toPromise()
|
const response = await apiClient.private.mutation(updateAuthor, { profile: input }).toPromise()
|
||||||
return response.data.update_profile
|
return response.data.update_author
|
||||||
},
|
},
|
||||||
getTopic: async ({ slug }: { slug: string }): Promise<Topic> => {
|
getTopic: async ({ slug }: { slug: string }): Promise<Topic> => {
|
||||||
const response = await publicGraphQLClient.query(topicBySlug, { slug }).toPromise()
|
const response = await publicGraphQLClient.query(topicBySlug, { slug }).toPromise()
|
||||||
|
@ -233,7 +233,7 @@ export const apiClient = {
|
||||||
.toPromise()
|
.toPromise()
|
||||||
return resp.data.load_reactions_by
|
return resp.data.load_reactions_by
|
||||||
},
|
},
|
||||||
getMySubscriptions: async (): Promise<Result> => {
|
getMySubscriptions: async (): Promise<CommonResult> => {
|
||||||
const resp = await apiClient.private.query(mySubscriptions, {}).toPromise()
|
const resp = await apiClient.private.query(mySubscriptions, {}).toPromise()
|
||||||
|
|
||||||
return resp.data.get_my_followed
|
return resp.data.get_my_followed
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { gql } from '@urql/core'
|
||||||
|
|
||||||
export default gql`
|
export default gql`
|
||||||
mutation ProfileUpdateMutation($profile: ProfileInput!) {
|
mutation ProfileUpdateMutation($profile: ProfileInput!) {
|
||||||
update_profile(profile: $profile) {
|
update_author(profile: $profile) {
|
||||||
error
|
error
|
||||||
author {
|
author {
|
||||||
name
|
name
|
Loading…
Reference in New Issue
Block a user