common-result-api

This commit is contained in:
Untone 2024-02-03 17:58:41 +03:00
parent 62250ba239
commit bdd044524d
3 changed files with 8 additions and 8 deletions

View File

@ -33,7 +33,7 @@ export const ProfileFormProvider = (props: { children: JSX.Element }) => {
const [form, setForm] = createStore<ProfileInput>({})
const submit = async (profile: ProfileInput) => {
const response = await apiClient.updateProfile(profile)
const response = await apiClient.updateAuthor(profile)
if (response.error) {
console.error(response.error)
throw response.error

View File

@ -8,7 +8,7 @@ import type {
ReactionInput,
ReactionBy,
Shout,
Result,
CommonResult,
QueryLoad_Authors_ByArgs,
QueryLoad_Shouts_SearchArgs,
QueryLoad_Shouts_Random_TopArgs,
@ -26,7 +26,7 @@ import reactionCreate from '../mutation/core/reaction-create'
import reactionDestroy from '../mutation/core/reaction-destroy'
import reactionUpdate from '../mutation/core/reaction-update'
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 shoutsLoadBy from '../query/core/articles-load-by'
import draftsLoad from '../query/core/articles-load-drafts'
@ -137,9 +137,9 @@ export const apiClient = {
const response = await publicGraphQLClient.query(authorFollowedCommunities, { slug }).toPromise()
return response.data.get_communities_by_author
},
updateProfile: async (input: ProfileInput) => {
const response = await apiClient.private.mutation(updateProfile, { profile: input }).toPromise()
return response.data.update_profile
updateAuthor: async (input: ProfileInput) => {
const response = await apiClient.private.mutation(updateAuthor, { profile: input }).toPromise()
return response.data.update_author
},
getTopic: async ({ slug }: { slug: string }): Promise<Topic> => {
const response = await publicGraphQLClient.query(topicBySlug, { slug }).toPromise()
@ -233,7 +233,7 @@ export const apiClient = {
.toPromise()
return resp.data.load_reactions_by
},
getMySubscriptions: async (): Promise<Result> => {
getMySubscriptions: async (): Promise<CommonResult> => {
const resp = await apiClient.private.query(mySubscriptions, {}).toPromise()
return resp.data.get_my_followed

View File

@ -2,7 +2,7 @@ import { gql } from '@urql/core'
export default gql`
mutation ProfileUpdateMutation($profile: ProfileInput!) {
update_profile(profile: $profile) {
update_author(profile: $profile) {
error
author {
name