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