From 835e6fcee982d27bac9eeab768e1714bfc531aa5 Mon Sep 17 00:00:00 2001
From: bniwredyc
У каждого соавтора можно добавить роль
*/} diff --git a/src/context/editor.tsx b/src/context/editor.tsx index 9f5a3a04..d47877ad 100644 --- a/src/context/editor.tsx +++ b/src/context/editor.tsx @@ -1,7 +1,7 @@ import type { JSX } from 'solid-js' import { Accessor, createContext, createSignal, useContext } from 'solid-js' import { createStore, SetStoreFunction } from 'solid-js/store' -import { Topic } from '../graphql/types.gen' +import { Topic, TopicInput } from '../graphql/types.gen' import { apiClient } from '../utils/apiClient' import { useLocalize } from './localize' import { useSnackbar } from './snackbar' @@ -48,6 +48,14 @@ export function useEditorContext() { return useContext(EditorContext) } +const topic2topicInput = (topic: Topic): TopicInput => { + return { + id: topic.id, + slug: topic.slug, + title: topic.title + } +} + export const EditorProvider = (props: { children: JSX.Element }) => { const { t } = useLocalize() @@ -93,10 +101,10 @@ export const EditorProvider = (props: { children: JSX.Element }) => { shoutId: form.shoutId, shoutInput: { body: form.body, - topics: form.selectedTopics, + topics: form.selectedTopics.map((topic) => topic2topicInput(topic)), // authors?: InputMaybe