import { StrUtil } from '@pura/harmony-utils'
import { promptAction } from '@kit.ArkUI'

export class ToastUtils {

  static show(msg: string, isResponse: boolean = false) {
    if (StrUtil.isEmpty(msg)) return
    let message = msg
    if (isResponse) {
      let messageArray = message.split(',')
      if (messageArray.length > 0) {
        message = messageArray[0]
      }
    }
    promptAction.showToast({
      message: message,
      duration: 1000
    })
  }
}