PHP 8.2.30
Preview: build-action-api-call-trigger.ts Size: 1.07 KB
//home/byroehnu/easepay.easetack.com/node_modules/adminjs/src/frontend/interfaces/action/build-action-api-call-trigger.ts

/* eslint-disable arrow-parens */
import { AxiosResponse } from 'axios'

import { ActionResponse } from '../../../backend/index.js'
import { DifferentActionParams, useActionResponseHandler } from '../../hooks/index.js'
import { ActionJSON } from './action-json.interface.js'
import { callActionApi } from './call-action-api.js'

export type CallApiFunction<K extends ActionResponse> = () => Promise<AxiosResponse<K>>

export type BuildActionCallApiTriggerOptions = {
  action: ActionJSON;
  params: DifferentActionParams;
  actionResponseHandler: ReturnType<typeof useActionResponseHandler>;
  search?: Location['search'];
}

export const buildActionCallApiTrigger = <K extends ActionResponse>(
  options: BuildActionCallApiTriggerOptions,
): CallApiFunction<K> => {
  const { action, params, actionResponseHandler, search } = options
  const callApi: CallApiFunction<K> = () => {
    const promise = callActionApi(action, params, search)
    promise.then(actionResponseHandler).catch((error) => {
      throw error
    })

    return promise as Promise<AxiosResponse<K>>
  }
  return callApi
}

Directory Contents

Dirs: 0 × Files: 12

Name Size Perms Modified Actions
127 B lr--r--r-- 2026-03-14 01:49:20
Edit Download
325 B lrw-r--r-- 2026-02-28 00:31:58
Edit Download
1.04 KB lrw-r--r-- 2026-02-28 00:31:58
Edit Download
1.97 KB lrw-r--r-- 2026-02-28 00:31:58
Edit Download
1.07 KB lrw-r--r-- 2026-02-28 00:32:02
Edit Download
2.96 KB lrw-r--r-- 2026-02-28 00:32:02
Edit Download
146 B lrw-r--r-- 2026-02-28 00:32:02
Edit Download
1.58 KB lrw-r--r-- 2026-02-28 00:32:02
Edit Download
410 B lrw-r--r-- 2026-02-28 00:32:28
Edit Download
391 B lrw-r--r-- 2026-02-28 00:32:28
Edit Download
404 B lrw-r--r-- 2026-02-28 00:32:28
Edit Download
407 B lrw-r--r-- 2026-02-28 00:32:28
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).