Keep a continued draft on screen, ask before Edit drops rewritten copy, and retry clearing the draft after publish.
This commit is contained in:
1 parent
54a4871ad1
commit
7c08766092
11 files changed
+361
-41
No files matched your search
+8
-7
@@ -164,19 +164,20 @@ async function errorBodyMessage(res: Response): Promise<string> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wipe the signed-in user's saved draft. Fire-and-forget: any non-2xx (including
|
||||
* the sync-flag-off `503` and the unauthenticated `401`) is swallowed because
|
||||
* callers only invoke this on already-published / explicitly-discarded flows
|
||||
* where a leftover server draft is acceptable.
|
||||
* Wipe the signed-in user's saved draft.
|
||||
* Returns true when the server confirms the draft is gone.
|
||||
* Callers that only need a best-effort wipe can ignore a false result
|
||||
* (`503` when sync is off, `401` when signed out, or a network error).
|
||||
*/
|
||||
export async function deleteServerDraft(): Promise<void> {
|
||||
export async function deleteServerDraft(): Promise<boolean> {
|
||||
try {
|
||||
await fetch("/api/drafts/me", {
|
||||
const res = await fetch("/api/drafts/me", {
|
||||
method: "DELETE",
|
||||
credentials: "include",
|
||||
});
|
||||
return res.ok;
|
||||
} catch {
|
||||
/* ignore — server draft cleanup is best-effort */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user