levinthiel / color-theme

https://color-theme-chi.vercel.app
0 stars 0 forks source link

#7: Fetch API to Check If Contrast Is Okay #2

Closed levinthiel closed 2 days ago

levinthiel commented 4 days ago

As a Developer

I want to check the contrast ratio via an API when colors are added or edited

in order to ensure accessibility compliance.

https://github.com/neuefische/web-react-recap-project/assets/93415777/acb2b6f6-6a34-4300-957b-b766de773c7f

Acceptance Criteria

Tasks

Hint

This is how you can send data to an API, it is called a post request.

 async function postFetch() {
      const response = await fetch(
        "https://www.some-api-url.com/api",
        {
          method: "POST",
          body: JSON.stringify({ cool: true }),
          headers: {
           "Content-Type": "application/json",
         },
        }
      );
}
levinthiel commented 2 days ago

(*)so I had a thinking issue, I had to check ALL the colors in the array and keep the constrast check up to date so my initial path was completely wrong (but funny enough the function kinda worked)