Skip to content

Commit

Permalink
fix merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SaxonF committed Jun 14, 2023
1 parent fc692d0 commit 0d25392
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions packages/edit-site/src/components/change-status/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,18 @@ const STATUS_OPTIONS = [
},
];

export default function ChangeStatus( { post } ) {
export default function ChangeStatus( {
postType,
postId,
postStatus: initialStatus,
password: initialPassword,
date: initialDate,
} ) {
const [ isCreatingPage, setIsCreatingPage ] = useState( false );
const [ status, setStatus ] = useState( post.status );
const [ date, setDate ] = useState( post.date );
const [ showPassword, setShowPassword ] = useState( !! post.password );
const [ password, setPassword ] = useState( post.password );
const [ status, setStatus ] = useState( initialStatus );
const [ date, setDate ] = useState( initialDate );
const [ showPassword, setShowPassword ] = useState( !! initialPassword );
const [ password, setPassword ] = useState( initialPassword );
const [ isOpen, setOpen ] = useState( false );
const openModal = () => setOpen( true );
const closeModal = () => setOpen( false );
Expand All @@ -72,7 +78,7 @@ export default function ChangeStatus( { post } ) {
}
setIsCreatingPage( true );
try {
await editEntityRecord( 'postType', post.type, post.id, {
await editEntityRecord( 'postType', postType, postId, {
status,
date,
password,
Expand Down Expand Up @@ -121,8 +127,8 @@ export default function ChangeStatus( { post } ) {
onClick={ openModal }
>
<StatusLabel
status={ post?.password ? 'protected' : post.status }
date={ post?.date }
status={ initialPassword ? 'protected' : initialStatus }
date={ initialDate }
/>
</Button>
{ isOpen && (
Expand Down

0 comments on commit 0d25392

Please sign in to comment.