import { uniHookRouter } from 't-comm/es/router/uni-hook-router';

import { navigateData, type NavType } from './index';


function setNavType(navType: NavType, args: any) {
  console.info('setNavType', navType, args);
  if (!args?.disableSetNavType) {
    navigateData.setNavType(navType);
  }
}


export function hookRouterInPageAnimation() {
  uniHookRouter({
    navigateToHooks: [(options: any) => setNavType('push', options)],
    navigateBackHooks: [(options: any) => setNavType('back', options)],
    redirectToHooks: [(options: any) => setNavType('replace', options)],
  });
}
