Change default template in the block editor (Gutenberg)

I was looking for the same thing.
This Answer by SkyShab did the trick. Posted below for convenience.


wp.data.dispatch('core/editor').editPost( {template: "template-name.php"} )

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)