mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 21:23:45 +01:00
Github Sync: enhance token handling and post-sync indexing
- support file-based token cipher - reindex references after sync - fix typo and clean up code
This commit is contained in:
+12
-2
@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'
|
||||
import { debugConsole } from '@/utils/debugging'
|
||||
import { postJSON } from '@/infrastructure/fetch-json'
|
||||
import useAsync from '@/shared/hooks/use-async'
|
||||
import clientId from '@/utils/client-id'
|
||||
import {
|
||||
OLModalBody,
|
||||
OLModalFooter,
|
||||
@@ -11,6 +12,8 @@ import OLButton from '@/shared/components/ol/ol-button'
|
||||
import OLNotification from '@/shared/components/ol/ol-notification'
|
||||
import { GitSyncModalStatus, ProjectSyncState } from '../../types/git-sync-types'
|
||||
|
||||
import { useReferencesContext } from '@/features/ide-react/context/references-context'
|
||||
|
||||
type GitSyncMergeModalProps = {
|
||||
handleHide: () => void
|
||||
modalStatus: GitSyncModalStatus
|
||||
@@ -29,10 +32,11 @@ const GitSyncMergeModal = ({
|
||||
commitMessage,
|
||||
setCommitMessage,
|
||||
projectId
|
||||
}: GitSynMergeModalProps) => {
|
||||
}: GitSyncMergeModalProps) => {
|
||||
|
||||
const { t } = useTranslation()
|
||||
const { error, isError, isLoading, setError, runAsync } = useAsync<ProjectSyncState>()
|
||||
const { indexAllReferences } = useReferencesContext()
|
||||
|
||||
useEffect(() => {
|
||||
if (modalStatus !== 'run-merge' &&
|
||||
@@ -46,11 +50,17 @@ const GitSyncMergeModal = ({
|
||||
body: { message: commitMessage, claimConflictIsResolved },
|
||||
})
|
||||
)
|
||||
.then(data => {
|
||||
.then(async data => {
|
||||
switch (data.mergeStatus) {
|
||||
|
||||
case 'clean':
|
||||
setModalStatus('merge-overview')
|
||||
|
||||
await postJSON(`/project/${projectId}/flush`)
|
||||
.catch(e => debugConsole.error(e))
|
||||
|
||||
indexAllReferences(true)
|
||||
|
||||
break
|
||||
|
||||
case 'conflict':
|
||||
|
||||
Reference in New Issue
Block a user