const mapConfigPlugins = (config) => {
  const plugins = [];
  if (config.onBeforeRequest) {
    plugins.push({
      hooks: {
        beforeRequest: async (payload) => {
          const result = await config.onBeforeRequest?.(payload);
          if (result) {
            return result;
          }
          return payload;
        }
      }
    });
  }
  if (config.onRequestSent) {
    plugins.push({
      hooks: {
        responseReceived: (payload) => {
          config.onRequestSent?.(payload.request.url);
        }
      }
    });
  }
  return plugins;
};
export {
  mapConfigPlugins
};
