import { useUserStore, type LogoutInterceptor } from '@/stores/user';
import { onUnmounted } from 'vue';

export function useLogoutInterceptor(fn: LogoutInterceptor) {
  const userStore = useUserStore();
  userStore.addLogoutInterceptor(fn);
  const remove = () => {
    userStore.removeLogoutInterceptor(fn);
  };
  onUnmounted(remove);
  return remove;
}
