Skip to content

Commit

Permalink
fix(frontend): fix preview args
Browse files Browse the repository at this point in the history
  • Loading branch information
lionelB committed Dec 18, 2020
1 parent 84bd21c commit db964f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
10 changes: 4 additions & 6 deletions targets/frontend/src/pages/contenus/[id].js
Expand Up @@ -85,7 +85,7 @@ export function DocumentPage() {
metaDescription: jsonDoc.current.meta_description,
text: jsonDoc.current.text,
title: jsonDoc.current.title,
}).then(({ data }) => {
}).then(({ data, error }) => {
const {
cdtnId,
source,
Expand All @@ -94,7 +94,9 @@ export function DocumentPage() {
text,
title,
} = data.document;

if (error) {
console.error("update impossible", error.message);
}
previewContent({
cdtnId,
document: {
Expand All @@ -109,10 +111,6 @@ export function DocumentPage() {
console.error("preview impossible", response.error.message);
}
});

if (result.error) {
console.error(result.error);
}
setHasChanged(false);
setSubmitIdle(false);
});
Expand Down
15 changes: 10 additions & 5 deletions targets/frontend/src/pages/contenus/edit/[id].js
Expand Up @@ -85,16 +85,21 @@ export function EditInformationPage() {
slug: slugify(title),
title,
});

const {
cdtnId,
slug,
metaDescription: metaDesc,
source,
} = result.data.update_documents_by_pk;
previewContent({
cdtnId: result.cdtnId,
cdtnId,
document: {
...document,
metaDescription: result.metaDescription,
slug: result.slug,
metaDescription: metaDesc,
slug,
title,
},
source: result.source,
source,
}).then((response) => {
if (response.error) {
console.error("preview impossible", response.error.message);
Expand Down

0 comments on commit db964f6

Please sign in to comment.