import type { ScanParams } from '../types'
import { action } from './action'

export const toScan = (config: ScanParams) => {
  const { targetUrl, fail } = config

  action({
    actionType: 'scan',
    targetUrl
  }).catch((err) => {
    if (fail) {
      fail(err)
    }
  })
}
