Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

vinayakakv/graphcms-uix-trigger-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graphcms-uix-trigger-api

A GraphCMS UI extension to trigger POST request to an API endpoint.

Configuration options

  • API Endpoint
  • API Key: It will be added in Authorization header as Bearer token

Request specification

The extension will POST the API endpoint.

The body of the request contains all fields of the current object, along with the model name, in the JSON format.

Some Caveats

  • CORS must be enabled on the API endpoint to accept request from the UIX domain (https://graphcms-uix-trigger-api.vercel.app). The CORS must also allow the header Authorization, and the HTTP methods OPTIONS and POST.
  • The request does not set Content-Type: application/json header. I found it a little inconvient to use with NextJS API routes.

Possible Improvements

  • Migrate project from CRA to Vite
  • In case CORS can not be enabled on the server, we can add no-cors mode to fetch. This will make the response type opaque
  • Support customization by adding few fields when adding UIX to sidebar
  • Stylize the UI

Thanks

Releases

No releases published

Packages

No packages published