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