feat: working drafts

This commit is contained in:
James
2021-12-31 14:02:16 -05:00
parent a2024b4f64
commit b00517ec20
2 changed files with 4 additions and 4 deletions

View File

@@ -12,8 +12,8 @@ const Publish: React.FC<Props> = () => {
const hasNewerVersions = unpublishedVersions?.totalDocs > 0;
const canPublish = modified || hasNewerVersions || !publishedDoc;
const publish = useCallback(() => {
submit({
const publish = useCallback(async () => {
await submit({
overrides: {
_status: 'published',
},

View File

@@ -18,7 +18,7 @@ const SaveDraft: React.FC = () => {
const canSaveDraft = modified;
const saveDraft = useCallback(() => {
const saveDraft = useCallback(async () => {
const search = `?locale=${locale}&depth=0&fallback-locale=null&draft=true`;
let action;
let method = 'POST';
@@ -32,7 +32,7 @@ const SaveDraft: React.FC = () => {
action = `${serverURL}${api}/globals/${global.slug}${search}`;
}
submit({
await submit({
action,
method,
overrides: {