export const useMain = () => {
  const generatorList = (template: Record<string, any>, number: number) => {
    const list = []
    for (let i = 0; i < number; i++) {
      const item = { ...template }
      item.id = `a${i}`
      item.name = `name ${i}`
      list.push(item)
    }
    return list
  }

  const sleep = async (time: number) => {
    return new Promise((resolve) => {
      setTimeout(() => {
        resolve(true)
      }, time)
    })
  }

  return {
    generatorList,
    sleep
  }
}
