Skip to content

Commit

Permalink
fix: prevent author value from changing by editors on save (freeCodeC…
Browse files Browse the repository at this point in the history
…amp#437)

Co-authored-by: yoko <[email protected]>
  • Loading branch information
Nirajn2311 and sidemt authored Feb 14, 2024
1 parent 511ccad commit 3b34d01
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/frontend/src/components/post-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ const PostForm = ({ tags, user, authors, post }) => {
useEffect(() => {
if (post) {
const apiBase = process.env.NEXT_PUBLIC_STRAPI_BACKEND_URL;
const { title, body, slug, tags, feature_image } = post.attributes;
const { title, body, slug, tags, feature_image, author } =
post.attributes;
const tagIds = tags.data.map((tag) => tag.id);

setTitle(title);
setContent(body);
setAuthor(author.data.id);

setPostUrl(slug ?? "");
setPostId(post.id);
Expand Down

0 comments on commit 3b34d01

Please sign in to comment.