layouts-apifixed
This commit is contained in:
commit
a69ce90f2d
|
@ -2,7 +2,7 @@ import styles from './DialogCard.module.scss'
|
||||||
import DialogAvatar from './DialogAvatar'
|
import DialogAvatar from './DialogAvatar'
|
||||||
import type { Author, AuthResult } from '../../graphql/types.gen'
|
import type { Author, AuthResult } from '../../graphql/types.gen'
|
||||||
import { useSession } from '../../context/session'
|
import { useSession } from '../../context/session'
|
||||||
import { createMemo, InitializedResource } from 'solid-js'
|
import { createMemo } from 'solid-js'
|
||||||
import { apiClient } from '../../utils/apiClient'
|
import { apiClient } from '../../utils/apiClient'
|
||||||
|
|
||||||
type DialogProps = {
|
type DialogProps = {
|
||||||
|
@ -22,11 +22,11 @@ const DialogCard = (props: DialogProps) => {
|
||||||
|
|
||||||
const handleOpenChat = async () => {
|
const handleOpenChat = async () => {
|
||||||
try {
|
try {
|
||||||
const test = await apiClient.createChat({
|
const initChat = await apiClient.createChat({
|
||||||
title: 'test chat',
|
title: 'test chat',
|
||||||
members: [props.author.slug, currentSession().user.slug]
|
members: [props.author.slug, currentSession().user.slug]
|
||||||
})
|
})
|
||||||
console.log('!!! test:', test)
|
// console.log('!!! test:', test)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('!!! errr:', error)
|
console.log('!!! errr:', error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ export const ForgotPasswordForm = () => {
|
||||||
setValidationErrors(({ email: _notNeeded, ...rest }) => rest)
|
setValidationErrors(({ email: _notNeeded, ...rest }) => rest)
|
||||||
setEmail(newEmail)
|
setEmail(newEmail)
|
||||||
}
|
}
|
||||||
const [sended, setSended] = createSignal(false)
|
|
||||||
const [submitError, setSubmitError] = createSignal('')
|
const [submitError, setSubmitError] = createSignal('')
|
||||||
const [isSubmitting, setIsSubmitting] = createSignal(false)
|
const [isSubmitting, setIsSubmitting] = createSignal(false)
|
||||||
const [validationErrors, setValidationErrors] = createSignal<ValidationErrors>({})
|
const [validationErrors, setValidationErrors] = createSignal<ValidationErrors>({})
|
||||||
|
@ -69,12 +69,7 @@ export const ForgotPasswordForm = () => {
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
<h4>{t('Forgot password?')}</h4>
|
<h4>{t('Forgot password?')}</h4>
|
||||||
<Show
|
|
||||||
when={!sended()}
|
|
||||||
fallback={<div class={styles.authInfo}>{t('Link sent, check your email')}</div>}
|
|
||||||
>
|
|
||||||
<div class={styles.authSubtitle}>{t('Everything is ok, please give us your email address')}</div>
|
<div class={styles.authSubtitle}>{t('Everything is ok, please give us your email address')}</div>
|
||||||
</Show>
|
|
||||||
<Show when={submitError()}>
|
<Show when={submitError()}>
|
||||||
<div class={styles.authInfo}>
|
<div class={styles.authInfo}>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { clsx } from 'clsx'
|
||||||
import { handleClientRouteLinkClick, useRouter } from '../../stores/router'
|
import { handleClientRouteLinkClick, useRouter } from '../../stores/router'
|
||||||
import { t } from '../../utils/intl'
|
import { t } from '../../utils/intl'
|
||||||
import { Icon } from '../_shared/Icon'
|
import { Icon } from '../_shared/Icon'
|
||||||
import { createSignal, onMount, Show } from 'solid-js'
|
import { createSignal, Show } from 'solid-js'
|
||||||
import Notifications from './Notifications'
|
import Notifications from './Notifications'
|
||||||
import { ProfilePopup } from './ProfilePopup'
|
import { ProfilePopup } from './ProfilePopup'
|
||||||
import Userpic from '../Author/Userpic'
|
import Userpic from '../Author/Userpic'
|
||||||
|
|
|
@ -18,6 +18,7 @@ export const ProfileModal = () => {
|
||||||
|
|
||||||
const author = createMemo<Author>(() => {
|
const author = createMemo<Author>(() => {
|
||||||
const a: Author = {
|
const a: Author = {
|
||||||
|
id: null,
|
||||||
name: 'anonymous',
|
name: 'anonymous',
|
||||||
userpic: '',
|
userpic: '',
|
||||||
slug: ''
|
slug: ''
|
||||||
|
|
|
@ -13,6 +13,7 @@ import '../../styles/Inbox.scss'
|
||||||
import { createClient } from '@urql/core'
|
import { createClient } from '@urql/core'
|
||||||
import { findAndLoadGraphQLConfig } from '@graphql-codegen/cli'
|
import { findAndLoadGraphQLConfig } from '@graphql-codegen/cli'
|
||||||
// import { useAuthStore } from '../../stores/auth'
|
// import { useAuthStore } from '../../stores/auth'
|
||||||
|
import { useSession } from '../../context/session'
|
||||||
|
|
||||||
const OWNER_ID = '501'
|
const OWNER_ID = '501'
|
||||||
const client = createClient({
|
const client = createClient({
|
||||||
|
@ -66,11 +67,15 @@ export const InboxView = () => {
|
||||||
const [authors, setAuthors] = createSignal<Author[]>([])
|
const [authors, setAuthors] = createSignal<Author[]>([])
|
||||||
const [postMessageText, setPostMessageText] = createSignal('')
|
const [postMessageText, setPostMessageText] = createSignal('')
|
||||||
const [loading, setLoading] = createSignal<boolean>(false)
|
const [loading, setLoading] = createSignal<boolean>(false)
|
||||||
|
const [currentSlug, setCurrentSlug] = createSignal<Author['slug'] | null>()
|
||||||
|
|
||||||
|
const { session } = useSession()
|
||||||
const { sortedAuthors } = useAuthorsStore()
|
const { sortedAuthors } = useAuthorsStore()
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
setAuthors(sortedAuthors())
|
setAuthors(sortedAuthors())
|
||||||
|
console.log('!!! session():', session())
|
||||||
|
setCurrentSlug(session()?.user?.slug)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Поиск по диалогам
|
// Поиск по диалогам
|
||||||
|
@ -97,30 +102,31 @@ export const InboxView = () => {
|
||||||
let chatWindow
|
let chatWindow
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
|
try {
|
||||||
await fetchMessages(messageQuery)
|
await fetchMessages(messageQuery)
|
||||||
.then(() => {
|
} catch (error) {
|
||||||
|
setLoading(false)
|
||||||
|
console.error([fetchMessages], error)
|
||||||
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
chatWindow.scrollTop = chatWindow.scrollHeight
|
chatWindow.scrollTop = chatWindow.scrollHeight
|
||||||
})
|
}
|
||||||
.catch(() => setLoading(false))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
postMessage(postMessageText())
|
try {
|
||||||
.then((result) => {
|
const post = await postMessage(postMessageText())
|
||||||
setMessages((prev) => [...prev, result])
|
setMessages((prev) => [...prev, post])
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
setPostMessageText('')
|
setPostMessageText('')
|
||||||
chatWindow.scrollTop = chatWindow.scrollHeight
|
chatWindow.scrollTop = chatWindow.scrollHeight
|
||||||
})
|
} catch (error) {
|
||||||
.catch(console.error)
|
console.error('[post message error]:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const handleChangeMessage = (event) => {
|
const handleChangeMessage = (event) => {
|
||||||
setPostMessageText(event.target.value)
|
setPostMessageText(event.target.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: get user session
|
|
||||||
return (
|
return (
|
||||||
<div class="messages container">
|
<div class="messages container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -24,18 +24,42 @@ export type AuthResult = {
|
||||||
export type Author = {
|
export type Author = {
|
||||||
bio?: Maybe<Scalars['String']>
|
bio?: Maybe<Scalars['String']>
|
||||||
caption?: Maybe<Scalars['String']>
|
caption?: Maybe<Scalars['String']>
|
||||||
|
id: Scalars['Int']
|
||||||
|
lastSeen?: Maybe<Scalars['DateTime']>
|
||||||
links?: Maybe<Array<Maybe<Scalars['String']>>>
|
links?: Maybe<Array<Maybe<Scalars['String']>>>
|
||||||
name: Scalars['String']
|
name: Scalars['String']
|
||||||
|
roles?: Maybe<Array<Maybe<Role>>>
|
||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
|
stat?: Maybe<AuthorStat>
|
||||||
userpic?: Maybe<Scalars['String']>
|
userpic?: Maybe<Scalars['String']>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type AuthorStat = {
|
||||||
|
commented?: Maybe<Scalars['Int']>
|
||||||
|
followers?: Maybe<Scalars['Int']>
|
||||||
|
followings?: Maybe<Scalars['Int']>
|
||||||
|
rating?: Maybe<Scalars['Int']>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AuthorsBy = {
|
||||||
|
createdAt?: InputMaybe<Scalars['DateTime']>
|
||||||
|
days?: InputMaybe<Scalars['Int']>
|
||||||
|
lastSeen?: InputMaybe<Scalars['DateTime']>
|
||||||
|
name?: InputMaybe<Scalars['String']>
|
||||||
|
order?: InputMaybe<Scalars['String']>
|
||||||
|
slug?: InputMaybe<Scalars['String']>
|
||||||
|
stat?: InputMaybe<Scalars['String']>
|
||||||
|
topic?: InputMaybe<Scalars['String']>
|
||||||
|
}
|
||||||
|
|
||||||
export type Chat = {
|
export type Chat = {
|
||||||
|
admins?: Maybe<Array<Maybe<User>>>
|
||||||
createdAt: Scalars['Int']
|
createdAt: Scalars['Int']
|
||||||
createdBy: User
|
createdBy: User
|
||||||
description?: Maybe<Scalars['String']>
|
description?: Maybe<Scalars['String']>
|
||||||
id: Scalars['Int']
|
id: Scalars['String']
|
||||||
messages: Array<Maybe<Message>>
|
messages: Array<Maybe<Message>>
|
||||||
|
private?: Maybe<Scalars['Boolean']>
|
||||||
title?: Maybe<Scalars['String']>
|
title?: Maybe<Scalars['String']>
|
||||||
unread?: Maybe<Scalars['Int']>
|
unread?: Maybe<Scalars['Int']>
|
||||||
updatedAt: Scalars['Int']
|
updatedAt: Scalars['Int']
|
||||||
|
@ -52,8 +76,8 @@ export type ChatMember = {
|
||||||
invitedAt?: Maybe<Scalars['DateTime']>
|
invitedAt?: Maybe<Scalars['DateTime']>
|
||||||
invitedBy?: Maybe<Scalars['String']>
|
invitedBy?: Maybe<Scalars['String']>
|
||||||
name: Scalars['String']
|
name: Scalars['String']
|
||||||
pic?: Maybe<Scalars['String']>
|
|
||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
|
userpic?: Maybe<Scalars['String']>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Collab = {
|
export type Collab = {
|
||||||
|
@ -69,6 +93,7 @@ export type Collection = {
|
||||||
createdAt: Scalars['DateTime']
|
createdAt: Scalars['DateTime']
|
||||||
createdBy: User
|
createdBy: User
|
||||||
desc?: Maybe<Scalars['String']>
|
desc?: Maybe<Scalars['String']>
|
||||||
|
id: Scalars['Int']
|
||||||
publishedAt?: Maybe<Scalars['DateTime']>
|
publishedAt?: Maybe<Scalars['DateTime']>
|
||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
title: Scalars['String']
|
title: Scalars['String']
|
||||||
|
@ -78,6 +103,7 @@ export type Community = {
|
||||||
createdAt: Scalars['DateTime']
|
createdAt: Scalars['DateTime']
|
||||||
createdBy: User
|
createdBy: User
|
||||||
desc?: Maybe<Scalars['String']>
|
desc?: Maybe<Scalars['String']>
|
||||||
|
id: Scalars['Int']
|
||||||
name: Scalars['String']
|
name: Scalars['String']
|
||||||
pic: Scalars['String']
|
pic: Scalars['String']
|
||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
|
@ -96,7 +122,7 @@ export type Message = {
|
||||||
chatId: Scalars['String']
|
chatId: Scalars['String']
|
||||||
createdAt: Scalars['Int']
|
createdAt: Scalars['Int']
|
||||||
id: Scalars['Int']
|
id: Scalars['Int']
|
||||||
replyTo?: Maybe<Scalars['Int']>
|
replyTo?: Maybe<Scalars['String']>
|
||||||
updatedAt?: Maybe<Scalars['Int']>
|
updatedAt?: Maybe<Scalars['Int']>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,8 +148,7 @@ export type Mutation = {
|
||||||
createReaction: Result
|
createReaction: Result
|
||||||
createShout: Result
|
createShout: Result
|
||||||
createTopic: Result
|
createTopic: Result
|
||||||
deleteCollection: Result
|
deleteChat: Result
|
||||||
deleteCommunity: Result
|
|
||||||
deleteMessage: Result
|
deleteMessage: Result
|
||||||
deleteReaction: Result
|
deleteReaction: Result
|
||||||
deleteShout: Result
|
deleteShout: Result
|
||||||
|
@ -159,7 +184,7 @@ export type MutationCreateChatArgs = {
|
||||||
export type MutationCreateMessageArgs = {
|
export type MutationCreateMessageArgs = {
|
||||||
body: Scalars['String']
|
body: Scalars['String']
|
||||||
chatId: Scalars['String']
|
chatId: Scalars['String']
|
||||||
replyTo?: InputMaybe<Scalars['Int']>
|
replyTo?: InputMaybe<Scalars['String']>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MutationCreateReactionArgs = {
|
export type MutationCreateReactionArgs = {
|
||||||
|
@ -174,12 +199,8 @@ export type MutationCreateTopicArgs = {
|
||||||
input: TopicInput
|
input: TopicInput
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MutationDeleteCollectionArgs = {
|
export type MutationDeleteChatArgs = {
|
||||||
slug: Scalars['String']
|
chatId: Scalars['String']
|
||||||
}
|
|
||||||
|
|
||||||
export type MutationDeleteCommunityArgs = {
|
|
||||||
slug: Scalars['String']
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MutationDeleteMessageArgs = {
|
export type MutationDeleteMessageArgs = {
|
||||||
|
@ -295,58 +316,34 @@ export type ProfileInput = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Query = {
|
export type Query = {
|
||||||
authorsAll: Array<Maybe<User>>
|
authorsAll: Array<Maybe<Author>>
|
||||||
collectionsAll: Array<Maybe<Collection>>
|
getAuthor: User
|
||||||
getCollabs: Array<Maybe<Collab>>
|
getCollabs: Array<Maybe<Collab>>
|
||||||
getCommunities: Array<Maybe<Community>>
|
getTopic: Topic
|
||||||
getCommunity: Community
|
|
||||||
getShoutBySlug: Shout
|
|
||||||
getUserCollections: Array<Maybe<Collection>>
|
|
||||||
getUserRoles: Array<Maybe<Role>>
|
|
||||||
getUsersBySlugs: Array<Maybe<User>>
|
|
||||||
isEmailUsed: Scalars['Boolean']
|
isEmailUsed: Scalars['Boolean']
|
||||||
loadChat: Array<Maybe<Message>>
|
loadAuthorsBy: Array<Maybe<Author>>
|
||||||
|
loadChats: Result
|
||||||
|
loadMessagesBy: Result
|
||||||
|
loadReactionsBy: Array<Maybe<Reaction>>
|
||||||
|
loadShoutsBy: Array<Maybe<Shout>>
|
||||||
markdownBody: Scalars['String']
|
markdownBody: Scalars['String']
|
||||||
myChats: Array<Maybe<Chat>>
|
searchUsers: Result
|
||||||
reactionsByAuthor: Array<Maybe<Reaction>>
|
|
||||||
reactionsForShouts: Array<Maybe<Reaction>>
|
|
||||||
recentAll: Array<Maybe<Shout>>
|
|
||||||
recentCandidates: Array<Maybe<Shout>>
|
|
||||||
recentCommented: Array<Maybe<Shout>>
|
|
||||||
recentPublished: Array<Maybe<Shout>>
|
|
||||||
recentReacted: Array<Maybe<Shout>>
|
|
||||||
searchQuery?: Maybe<Array<Maybe<Shout>>>
|
|
||||||
shoutsByAuthors: Array<Maybe<Shout>>
|
|
||||||
shoutsByCollection: Array<Maybe<Shout>>
|
|
||||||
shoutsByCommunities: Array<Maybe<Shout>>
|
|
||||||
shoutsByTopics: Array<Maybe<Shout>>
|
|
||||||
shoutsForFeed: Array<Maybe<Shout>>
|
|
||||||
signIn: AuthResult
|
signIn: AuthResult
|
||||||
signOut: AuthResult
|
signOut: AuthResult
|
||||||
topicsAll: Array<Maybe<Topic>>
|
topicsAll: Array<Maybe<Topic>>
|
||||||
topicsByAuthor: Array<Maybe<Topic>>
|
topicsByAuthor: Array<Maybe<Topic>>
|
||||||
topicsByCommunity: Array<Maybe<Topic>>
|
topicsByCommunity: Array<Maybe<Topic>>
|
||||||
topicsRandom: Array<Maybe<Topic>>
|
topicsRandom: Array<Maybe<Topic>>
|
||||||
userFollowedAuthors: Array<Maybe<User>>
|
userFollowedAuthors: Array<Maybe<Author>>
|
||||||
userFollowedCommunities: Array<Maybe<Community>>
|
|
||||||
userFollowedTopics: Array<Maybe<Topic>>
|
userFollowedTopics: Array<Maybe<Topic>>
|
||||||
userFollowers: Array<Maybe<User>>
|
userFollowers: Array<Maybe<Author>>
|
||||||
userReactedShouts: Array<Maybe<Shout>>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QueryGetCommunityArgs = {
|
export type QueryGetAuthorArgs = {
|
||||||
slug?: InputMaybe<Scalars['String']>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryGetShoutBySlugArgs = {
|
|
||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QueryGetUserCollectionsArgs = {
|
export type QueryGetTopicArgs = {
|
||||||
author: Scalars['String']
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryGetUserRolesArgs = {
|
|
||||||
slug: Scalars['String']
|
slug: Scalars['String']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,7 +351,30 @@ export type QueryIsEmailUsedArgs = {
|
||||||
email: Scalars['String']
|
email: Scalars['String']
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QueryLoadChatArgs = {
|
export type QueryLoadAuthorsByArgs = {
|
||||||
|
amount?: InputMaybe<Scalars['Int']>
|
||||||
|
by?: InputMaybe<AuthorsBy>
|
||||||
|
offset?: InputMaybe<Scalars['Int']>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryLoadChatsArgs = {
|
||||||
|
amount?: InputMaybe<Scalars['Int']>
|
||||||
|
offset?: InputMaybe<Scalars['Int']>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryLoadMessagesByArgs = {
|
||||||
|
amount?: InputMaybe<Scalars['Int']>
|
||||||
|
by: MessagesBy
|
||||||
|
offset?: InputMaybe<Scalars['Int']>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryLoadReactionsByArgs = {
|
||||||
|
amount?: InputMaybe<Scalars['Int']>
|
||||||
|
by: ReactionBy
|
||||||
|
limit?: InputMaybe<Scalars['Int']>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryLoadShoutsByArgs = {
|
||||||
amount?: InputMaybe<Scalars['Int']>
|
amount?: InputMaybe<Scalars['Int']>
|
||||||
by?: InputMaybe<ShoutsBy>
|
by?: InputMaybe<ShoutsBy>
|
||||||
offset?: InputMaybe<Scalars['Int']>
|
offset?: InputMaybe<Scalars['Int']>
|
||||||
|
@ -364,76 +384,10 @@ export type QueryMarkdownBodyArgs = {
|
||||||
body: Scalars['String']
|
body: Scalars['String']
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QueryReactionsByAuthorArgs = {
|
export type QuerySearchUsersArgs = {
|
||||||
limit: Scalars['Int']
|
amount?: InputMaybe<Scalars['Int']>
|
||||||
offset: Scalars['Int']
|
offset?: InputMaybe<Scalars['Int']>
|
||||||
slug: Scalars['String']
|
query: Scalars['String']
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryReactionsForShoutsArgs = {
|
|
||||||
limit: Scalars['Int']
|
|
||||||
offset: Scalars['Int']
|
|
||||||
shouts: Array<InputMaybe<Scalars['String']>>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryRecentAllArgs = {
|
|
||||||
limit: Scalars['Int']
|
|
||||||
offset: Scalars['Int']
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryRecentCandidatesArgs = {
|
|
||||||
limit: Scalars['Int']
|
|
||||||
offset: Scalars['Int']
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryRecentCommentedArgs = {
|
|
||||||
limit: Scalars['Int']
|
|
||||||
offset: Scalars['Int']
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryRecentPublishedArgs = {
|
|
||||||
limit: Scalars['Int']
|
|
||||||
offset: Scalars['Int']
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryRecentReactedArgs = {
|
|
||||||
limit: Scalars['Int']
|
|
||||||
offset: Scalars['Int']
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QuerySearchQueryArgs = {
|
|
||||||
limit: Scalars['Int']
|
|
||||||
offset: Scalars['Int']
|
|
||||||
q?: InputMaybe<Scalars['String']>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryShoutsByAuthorsArgs = {
|
|
||||||
limit: Scalars['Int']
|
|
||||||
offset: Scalars['Int']
|
|
||||||
slugs: Array<InputMaybe<Scalars['String']>>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryShoutsByCollectionArgs = {
|
|
||||||
collection: Scalars['String']
|
|
||||||
limit: Scalars['Int']
|
|
||||||
offset: Scalars['Int']
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryShoutsByCommunitiesArgs = {
|
|
||||||
limit: Scalars['Int']
|
|
||||||
offset: Scalars['Int']
|
|
||||||
slugs: Array<InputMaybe<Scalars['String']>>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryShoutsByTopicsArgs = {
|
|
||||||
limit: Scalars['Int']
|
|
||||||
offset: Scalars['Int']
|
|
||||||
slugs: Array<InputMaybe<Scalars['String']>>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type QueryShoutsForFeedArgs = {
|
|
||||||
limit: Scalars['Int']
|
|
||||||
offset: Scalars['Int']
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QuerySignInArgs = {
|
export type QuerySignInArgs = {
|
||||||
|
@ -494,7 +448,6 @@ export type ReactionBy = {
|
||||||
days?: InputMaybe<Scalars['Int']>
|
days?: InputMaybe<Scalars['Int']>
|
||||||
order?: InputMaybe<Scalars['String']>
|
order?: InputMaybe<Scalars['String']>
|
||||||
shout?: InputMaybe<Scalars['String']>
|
shout?: InputMaybe<Scalars['String']>
|
||||||
shouts?: InputMaybe<Array<InputMaybe<Scalars['String']>>>
|
|
||||||
stat?: InputMaybe<Scalars['String']>
|
stat?: InputMaybe<Scalars['String']>
|
||||||
topic?: InputMaybe<Scalars['String']>
|
topic?: InputMaybe<Scalars['String']>
|
||||||
}
|
}
|
||||||
|
@ -542,8 +495,8 @@ export type Resource = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Result = {
|
export type Result = {
|
||||||
author?: Maybe<User>
|
author?: Maybe<Author>
|
||||||
authors?: Maybe<Array<Maybe<User>>>
|
authors?: Maybe<Array<Maybe<Author>>>
|
||||||
chat?: Maybe<Chat>
|
chat?: Maybe<Chat>
|
||||||
chats?: Maybe<Array<Maybe<Chat>>>
|
chats?: Maybe<Array<Maybe<Chat>>>
|
||||||
communities?: Maybe<Array<Maybe<Community>>>
|
communities?: Maybe<Array<Maybe<Community>>>
|
||||||
|
@ -556,8 +509,10 @@ export type Result = {
|
||||||
reactions?: Maybe<Array<Maybe<Reaction>>>
|
reactions?: Maybe<Array<Maybe<Reaction>>>
|
||||||
shout?: Maybe<Shout>
|
shout?: Maybe<Shout>
|
||||||
shouts?: Maybe<Array<Maybe<Shout>>>
|
shouts?: Maybe<Array<Maybe<Shout>>>
|
||||||
|
slugs?: Maybe<Array<Maybe<Scalars['String']>>>
|
||||||
topic?: Maybe<Topic>
|
topic?: Maybe<Topic>
|
||||||
topics?: Maybe<Array<Maybe<Topic>>>
|
topics?: Maybe<Array<Maybe<Topic>>>
|
||||||
|
uids?: Maybe<Array<Maybe<Scalars['String']>>>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Role = {
|
export type Role = {
|
||||||
|
@ -576,7 +531,6 @@ export type Shout = {
|
||||||
createdAt: Scalars['DateTime']
|
createdAt: Scalars['DateTime']
|
||||||
deletedAt?: Maybe<Scalars['DateTime']>
|
deletedAt?: Maybe<Scalars['DateTime']>
|
||||||
deletedBy?: Maybe<User>
|
deletedBy?: Maybe<User>
|
||||||
draft?: Maybe<Scalars['Boolean']>
|
|
||||||
id: Scalars['Int']
|
id: Scalars['Int']
|
||||||
lang?: Maybe<Scalars['String']>
|
lang?: Maybe<Scalars['String']>
|
||||||
layout?: Maybe<Scalars['String']>
|
layout?: Maybe<Scalars['String']>
|
||||||
|
@ -591,8 +545,8 @@ export type Shout = {
|
||||||
topics?: Maybe<Array<Maybe<Topic>>>
|
topics?: Maybe<Array<Maybe<Topic>>>
|
||||||
updatedAt?: Maybe<Scalars['DateTime']>
|
updatedAt?: Maybe<Scalars['DateTime']>
|
||||||
updatedBy?: Maybe<User>
|
updatedBy?: Maybe<User>
|
||||||
versionOf?: Maybe<Shout>
|
versionOf?: Maybe<Scalars['String']>
|
||||||
visibleFor?: Maybe<Array<Maybe<User>>>
|
visibility?: Maybe<Scalars['String']>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ShoutInput = {
|
export type ShoutInput = {
|
||||||
|
@ -614,12 +568,10 @@ export type ShoutsBy = {
|
||||||
days?: InputMaybe<Scalars['Int']>
|
days?: InputMaybe<Scalars['Int']>
|
||||||
layout?: InputMaybe<Scalars['String']>
|
layout?: InputMaybe<Scalars['String']>
|
||||||
order?: InputMaybe<Scalars['String']>
|
order?: InputMaybe<Scalars['String']>
|
||||||
published?: InputMaybe<Scalars['Boolean']>
|
|
||||||
slug?: InputMaybe<Scalars['String']>
|
slug?: InputMaybe<Scalars['String']>
|
||||||
stat?: InputMaybe<Scalars['String']>
|
stat?: InputMaybe<Scalars['String']>
|
||||||
title?: InputMaybe<Scalars['String']>
|
title?: InputMaybe<Scalars['String']>
|
||||||
topic?: InputMaybe<Scalars['String']>
|
topic?: InputMaybe<Scalars['String']>
|
||||||
topics?: InputMaybe<Array<InputMaybe<Scalars['String']>>>
|
|
||||||
visibility?: InputMaybe<Scalars['String']>
|
visibility?: InputMaybe<Scalars['String']>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,4 @@
|
||||||
import type {
|
import type { FollowingEntity, AuthResult, ShoutInput, Topic, Author } from '../graphql/types.gen'
|
||||||
Reaction,
|
|
||||||
Shout,
|
|
||||||
FollowingEntity,
|
|
||||||
AuthResult,
|
|
||||||
ShoutInput,
|
|
||||||
Topic,
|
|
||||||
Author
|
|
||||||
} from '../graphql/types.gen'
|
|
||||||
import { publicGraphQLClient } from '../graphql/publicGraphQLClient'
|
import { publicGraphQLClient } from '../graphql/publicGraphQLClient'
|
||||||
import { getToken, privateGraphQLClient } from '../graphql/privateGraphQLClient'
|
import { getToken, privateGraphQLClient } from '../graphql/privateGraphQLClient'
|
||||||
import topicsAll from '../graphql/query/topics-all'
|
import topicsAll from '../graphql/query/topics-all'
|
||||||
|
@ -26,14 +18,14 @@ import reactionDestroy from '../graphql/mutation/reaction-destroy'
|
||||||
import reactionUpdate from '../graphql/mutation/reaction-update'
|
import reactionUpdate from '../graphql/mutation/reaction-update'
|
||||||
import createArticle from '../graphql/mutation/article-create'
|
import createArticle from '../graphql/mutation/article-create'
|
||||||
import myChats from '../graphql/query/chats-load'
|
import myChats from '../graphql/query/chats-load'
|
||||||
import loadChat from '../graphql/query/chat-messages-load-by'
|
import chatMessagesLoadBy from '../graphql/query/chat-messages-load-by'
|
||||||
import topicBySlug from '../graphql/query/topic-by-slug'
|
|
||||||
import authorBySlug from '../graphql/query/author-by-slug'
|
import authorBySlug from '../graphql/query/author-by-slug'
|
||||||
import shoutsLoadBy from '../graphql/query/articles-load-by'
|
import topicBySlug from '../graphql/query/topic-by-slug'
|
||||||
import reactionsLoadBy from '../graphql/query/reactions-load-by'
|
|
||||||
import authorsLoadBy from '../graphql/query/authors-load-by'
|
|
||||||
import createChatQuery from '../graphql/mutation/create-chat'
|
import createChatQuery from '../graphql/mutation/create-chat'
|
||||||
|
import reactionsLoadBy from '../graphql/query/reactions-load-by'
|
||||||
import { REACTIONS_AMOUNT_PER_PAGE } from '../stores/zine/reactions'
|
import { REACTIONS_AMOUNT_PER_PAGE } from '../stores/zine/reactions'
|
||||||
|
import authorsLoadBy from '../graphql/query/authors-load-by'
|
||||||
|
import shoutsLoadBy from '../graphql/query/articles-load-by'
|
||||||
|
|
||||||
const FEED_SIZE = 50
|
const FEED_SIZE = 50
|
||||||
|
|
||||||
|
@ -262,7 +254,7 @@ export const apiClient = {
|
||||||
const by = {
|
const by = {
|
||||||
chat
|
chat
|
||||||
}
|
}
|
||||||
const resp = await privateGraphQLClient.query(loadChat, { by, offset, amount }).toPromise()
|
const resp = await privateGraphQLClient.query(chatMessagesLoadBy, { by, offset, amount }).toPromise()
|
||||||
return resp.data.loadChat
|
return resp.data.loadChat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user