Fix expo types
This commit is contained in:
parent
bbd8ef798c
commit
ce0c2c0f0a
|
@ -2,20 +2,14 @@ import { Accessor, JSX, createContext, createEffect, createSignal, useContext }
|
|||
import { createStore } from 'solid-js/store'
|
||||
|
||||
import { apiClient } from '../graphql/client/core'
|
||||
import { Author, Community, FollowingEntity, Topic } from '../graphql/schema/core.gen'
|
||||
import { AuthorFollowsResult, FollowingEntity } from '../graphql/schema/core.gen'
|
||||
|
||||
import { useSession } from './session'
|
||||
|
||||
type AuthorFollows = {
|
||||
topics: Topic[]
|
||||
authors: Author[]
|
||||
communities: Community[]
|
||||
}
|
||||
|
||||
interface FollowingContextType {
|
||||
loading: Accessor<boolean>
|
||||
subscriptions: AuthorFollows
|
||||
setSubscriptions: (subscriptions: AuthorFollows) => void
|
||||
subscriptions: AuthorFollowsResult
|
||||
setSubscriptions: (subscriptions: AuthorFollowsResult) => void
|
||||
setFollowing: (what: FollowingEntity, slug: string, value: boolean) => void
|
||||
loadSubscriptions: () => void
|
||||
follow: (what: FollowingEntity, slug: string) => Promise<void>
|
||||
|
@ -29,7 +23,7 @@ export function useFollowing() {
|
|||
return useContext(FollowingContext)
|
||||
}
|
||||
|
||||
const EMPTY_SUBSCRIPTIONS: AuthorFollows = {
|
||||
const EMPTY_SUBSCRIPTIONS: AuthorFollowsResult = {
|
||||
topics: [],
|
||||
authors: [],
|
||||
communities: [],
|
||||
|
@ -37,7 +31,7 @@ const EMPTY_SUBSCRIPTIONS: AuthorFollows = {
|
|||
|
||||
export const FollowingProvider = (props: { children: JSX.Element }) => {
|
||||
const [loading, setLoading] = createSignal<boolean>(false)
|
||||
const [subscriptions, setSubscriptions] = createStore<AuthorFollows>(EMPTY_SUBSCRIPTIONS)
|
||||
const [subscriptions, setSubscriptions] = createStore<AuthorFollowsResult>(EMPTY_SUBSCRIPTIONS)
|
||||
const { author, session } = useSession()
|
||||
|
||||
const fetchData = async () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type {
|
||||
Author,
|
||||
AuthorFollows,
|
||||
AuthorFollowsResult,
|
||||
CommonResult,
|
||||
FollowingEntity,
|
||||
LoadShoutsOptions,
|
||||
|
@ -134,7 +134,7 @@ export const apiClient = {
|
|||
slug?: string
|
||||
author_id?: number
|
||||
user?: string
|
||||
}): Promise<AuthorFollows> => {
|
||||
}): Promise<AuthorFollowsResult> => {
|
||||
const response = await publicGraphQLClient.query(authorFollows, params).toPromise()
|
||||
return response.data.get_author_follows
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user