INNER CODE UNIT · TypeScript

addToStudy

gbtami/pychess-variants · client/analysis/index.ts:264

    const addToStudy = async () => {
        const tree = ctrl?.analysisTree;
        if (!ctrl || !tree) return;
        try {
            const defaultChapterName =
                model.gameId && model.wplayer && model.bplayer ? `${model.wplayer} - ${model.bplayer}` : _('Analysis');
            const destination = await chooseStudy(defaultChapterName);
            if (!destination) return;
            const tags = studyTagsFromAnalysis(model, ctrl);
            const response = await fetch('/study/from-analysis', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({
                    variant: model.variant || 'chess',
                    chess960: model.chess960 === 'True',
                    initialFen: tree.root.step.fen,
                    gameId: model.gameId || undefined,
                    studyId: destination.studyId,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…