How to redirect a specific topic to a category?

Ok, I’ve cobbled together a solution and it seems to work. Did I do this correctly, or am I doing terrible things? :see_no_evil:

<script type="text/discourse-plugin" version="0.8"> 
    // Modify the topic route. 
    api.modifyClass('route:topic', {
    
      beforeModel( transition ) {
        var params = this.paramsFor('topic');

        // English
        if( params['id'] == 123 ) {
          this.router.transitionTo('/c/tutorials/english/29'); // Implicitly aborts the on-going transition.
        }
        
        // French
        if( params['id'] == 456 ) {
          this.router.transitionTo('/c/tutorials/french/30'); // Implicitly aborts the on-going transition.
        }
                
      }
    
    });
</script>