no-created-by-unwrap

This commit is contained in:
Untone 2024-03-06 10:30:07 +03:00
parent 449154bd1b
commit ce66874089
3 changed files with 53 additions and 10 deletions

View File

@ -30,6 +30,7 @@ import unfollowMutation from '../mutation/core/unfollow'
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'
import getMyShout from '../query/core/article-my'
import myFeed from '../query/core/articles-load-feed' import myFeed from '../query/core/articles-load-feed'
import loadShoutsTopRandom from '../query/core/articles-load-random-top' import loadShoutsTopRandom from '../query/core/articles-load-random-top'
import articlesLoadRandomTopic from '../query/core/articles-load-random-topic' import articlesLoadRandomTopic from '../query/core/articles-load-random-topic'
@ -41,7 +42,6 @@ import authorFollows from '../query/core/author-follows'
import authorId from '../query/core/author-id' import authorId from '../query/core/author-id'
import authorsAll from '../query/core/authors-all' import authorsAll from '../query/core/authors-all'
import authorsLoadBy from '../query/core/authors-load-by' import authorsLoadBy from '../query/core/authors-load-by'
import mySubscriptions from '../query/core/my-followed'
import reactionsLoadBy from '../query/core/reactions-load-by' import reactionsLoadBy from '../query/core/reactions-load-by'
import topicBySlug from '../query/core/topic-by-slug' import topicBySlug from '../query/core/topic-by-slug'
import topicsAll from '../query/core/topics-all' import topicsAll from '../query/core/topics-all'
@ -206,10 +206,10 @@ export const apiClient = {
}, },
getMyShout: async (shout_id: number) => { getMyShout: async (shout_id: number) => {
const resp = await apiClient.private.query(shoutLoad, { shout_id }).toPromise() const resp = await apiClient.private.query(getMyShout, { shout_id }).toPromise()
if (resp.error) console.error(resp) if (resp.error) console.error(resp)
return resp.data.get_shout return resp.data.get_my_shout
}, },
getShouts: async (options: LoadShoutsOptions) => { getShouts: async (options: LoadShoutsOptions) => {

View File

@ -0,0 +1,50 @@
import { gql } from '@urql/core'
export default gql`
query GetMyShout($shout_id: Int!) {
get_my_shout(shout_id: $shout_id) {
id
title
lead
description
subtitle
slug
layout
cover
cover_caption
body
media
updated_by {
id
name
slug
pic
created_at
}
# community
main_topic
topics {
id
title
body
slug
stat {
shouts
authors
followers
}
}
authors {
id
name
slug
pic
created_at
}
created_at
updated_at
published_at
featured_at
}
}
`

View File

@ -23,13 +23,6 @@ export default gql`
followers followers
} }
} }
created_by {
id
name
slug
pic
created_at
}
authors { authors {
id id
name name