@@ -62,9 +62,9 @@ export class AddPostComponent implements OnInit {
6262 validators : [ Validators . required ] ,
6363 nonNullable : true ,
6464 } ) ,
65- date : new FormControl < Date | null > ( null ) ,
65+ created_at : new FormControl < Date | null > ( null ) ,
6666 description : new FormControl < string | null > ( null ) ,
67- isDraft : new FormControl ( false , { nonNullable : true } ) ,
67+ is_draft : new FormControl ( false , { nonNullable : true } ) ,
6868 } ) ;
6969 range : Range | null = null ;
7070
@@ -80,6 +80,7 @@ export class AddPostComponent implements OnInit {
8080 this . apiService . getPostById ( this . postId ) . subscribe ( ( post ) => {
8181 if ( post ) {
8282 this . blogForm . patchValue ( post ) ;
83+ console . log ( this . blogForm . value ) ;
8384 }
8485 } ) ;
8586 }
@@ -95,9 +96,9 @@ export class AddPostComponent implements OnInit {
9596 const rawContent = this . blogForm . controls . content . value as string ;
9697 const cleanedContent = rawContent . replace ( / ( & n b s p ; | \u00A0 ) / g, ' ' ) ;
9798 this . blogForm . controls . content . setValue ( cleanedContent ) ;
98- this . blogForm . controls . isDraft . setValue ( isDraft ) ;
99- if ( ! this . blogForm . controls . date . value ) {
100- this . blogForm . controls . date . setValue ( null ) ;
99+ this . blogForm . controls . is_draft . setValue ( isDraft ) ;
100+ if ( ! this . blogForm . controls . created_at . value ) {
101+ this . blogForm . controls . created_at . setValue ( null ) ;
101102 }
102103 if ( this . postId ) {
103104 this . apiService . updatePost ( this . postId , this . blogForm . value as Post ) ;
0 commit comments