[WIP]
This commit is contained in:
parent
80ffc564a9
commit
75caee909e
|
@ -156,7 +156,7 @@ export const LoginForm = () => {
|
||||||
<PasswordField
|
<PasswordField
|
||||||
variant={'login'}
|
variant={'login'}
|
||||||
setError={validationErrors().password}
|
setError={validationErrors().password}
|
||||||
onInput={(value) => handlePasswordInput(value)}
|
onBlur={(value) => handlePasswordInput(value)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Show when={submitError()}>
|
<Show when={submitError()}>
|
||||||
|
|
|
@ -12,7 +12,7 @@ type Props = {
|
||||||
placeholder?: string
|
placeholder?: string
|
||||||
errorMessage?: (error: string) => void
|
errorMessage?: (error: string) => void
|
||||||
setError?: string
|
setError?: string
|
||||||
onInput: (value: string) => void
|
onInput?: (value: string) => void
|
||||||
onBlur?: (value: string) => void
|
onBlur?: (value: string) => void
|
||||||
variant?: 'login' | 'registration'
|
variant?: 'login' | 'registration'
|
||||||
disableAutocomplete?: boolean
|
disableAutocomplete?: boolean
|
||||||
|
|
|
@ -50,9 +50,11 @@ export const FollowingProvider = (props: { children: JSX.Element }) => {
|
||||||
try {
|
try {
|
||||||
if (apiClient.private) {
|
if (apiClient.private) {
|
||||||
console.debug('[context.following] fetching subs data...')
|
console.debug('[context.following] fetching subs data...')
|
||||||
|
console.log("%c!!! session()?.user.id:", 'background: #222; color: #bada55', session());
|
||||||
|
|
||||||
const result = await apiClient.getAuthorFollows({ user: session()?.user.id })
|
const result = await apiClient.getAuthorFollows({ user: session()?.user.id })
|
||||||
|
console.log("!!! result:", result);
|
||||||
setSubscriptions(result || EMPTY_SUBSCRIPTIONS)
|
setSubscriptions(result || EMPTY_SUBSCRIPTIONS)
|
||||||
console.info('[context.following] subs:', subscriptions)
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.info('[context.following] cannot get subs', error)
|
console.info('[context.following] cannot get subs', error)
|
||||||
|
@ -61,8 +63,14 @@ export const FollowingProvider = (props: { children: JSX.Element }) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createEffect(() => {
|
||||||
|
console.info('[context.following] subs:', subscriptions);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
const follow = async (what: FollowingEntity, slug: string) => {
|
const follow = async (what: FollowingEntity, slug: string) => {
|
||||||
console.log("!!! flw:", author());
|
console.log("!!! follow what:", what);
|
||||||
|
console.log("!!! follow slug:", slug);
|
||||||
// if (!author()) return
|
// if (!author()) return
|
||||||
setSubscribeInAction({ slug, type: 'subscribe' })
|
setSubscribeInAction({ slug, type: 'subscribe' })
|
||||||
try {
|
try {
|
||||||
|
@ -98,11 +106,11 @@ export const FollowingProvider = (props: { children: JSX.Element }) => {
|
||||||
|
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
console.log("!!! cone setSubscribeInAction:", subscribeInAction());
|
// console.log("!!! cone setSubscribeInAction:", subscribeInAction());
|
||||||
if (author()) {
|
// if (author()) {
|
||||||
console.debug('[context.following] author update detect')
|
// console.debug('[context.following] author update detect')
|
||||||
fetchData()
|
// fetchData()
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
|
|
||||||
const setFollowing = (what: FollowingEntity, slug: string, value = true) => {
|
const setFollowing = (what: FollowingEntity, slug: string, value = true) => {
|
||||||
|
|
|
@ -92,7 +92,7 @@ export const apiClient = {
|
||||||
|
|
||||||
follow: async ({ what, slug }: { what: FollowingEntity; slug: string }) => {
|
follow: async ({ what, slug }: { what: FollowingEntity; slug: string }) => {
|
||||||
const response = await apiClient.private.mutation(followMutation, { what, slug }).toPromise()
|
const response = await apiClient.private.mutation(followMutation, { what, slug }).toPromise()
|
||||||
console.log("!!! response:", response);
|
console.log("!!! response FOLLOW AAAA:", 'background: #222; color: #bada55', response);
|
||||||
return response.data.follow
|
return response.data.follow
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,10 @@ export default gql`
|
||||||
mutation FollowMutation($what: FollowingEntity!, $slug: String!) {
|
mutation FollowMutation($what: FollowingEntity!, $slug: String!) {
|
||||||
follow(what: $what, slug: $slug) {
|
follow(what: $what, slug: $slug) {
|
||||||
error
|
error
|
||||||
|
authors {
|
||||||
|
id
|
||||||
|
slug
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user