fix: fix graphql history sync issue
This commit is contained in:
@@ -68,10 +68,13 @@ const purgeFormDataFromRequest = (req: RESTHistoryEntry): RESTHistoryEntry => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function writeHistory(
|
async function writeHistory(
|
||||||
entry: RESTHistoryEntry,
|
entry: RESTHistoryEntry | GQLHistoryEntry,
|
||||||
col: HistoryFBCollections
|
col: HistoryFBCollections
|
||||||
) {
|
) {
|
||||||
const processedEntry = purgeFormDataFromRequest(entry)
|
const processedEntry =
|
||||||
|
col === "history"
|
||||||
|
? purgeFormDataFromRequest(entry as RESTHistoryEntry)
|
||||||
|
: entry
|
||||||
|
|
||||||
if (currentUser$.value == null)
|
if (currentUser$.value == null)
|
||||||
throw new Error("User not logged in to sync history")
|
throw new Error("User not logged in to sync history")
|
||||||
@@ -93,7 +96,7 @@ async function writeHistory(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function deleteHistory(
|
async function deleteHistory(
|
||||||
entry: RESTHistoryEntry & { id: string },
|
entry: (RESTHistoryEntry | GQLHistoryEntry) & { id: string },
|
||||||
col: HistoryFBCollections
|
col: HistoryFBCollections
|
||||||
) {
|
) {
|
||||||
if (currentUser$.value == null)
|
if (currentUser$.value == null)
|
||||||
@@ -120,7 +123,10 @@ async function clearHistory(col: HistoryFBCollections) {
|
|||||||
await Promise.all(docs.map((e) => deleteHistory(e as any, col)))
|
await Promise.all(docs.map((e) => deleteHistory(e as any, col)))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleStar(entry: any, col: HistoryFBCollections) {
|
async function toggleStar(
|
||||||
|
entry: (RESTHistoryEntry | GQLHistoryEntry) & { id: string },
|
||||||
|
col: HistoryFBCollections
|
||||||
|
) {
|
||||||
if (currentUser$.value == null)
|
if (currentUser$.value == null)
|
||||||
throw new Error("User not logged in to toggle star")
|
throw new Error("User not logged in to toggle star")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user