K-Phoen / backstage-plugin-announcements

Announcements plugin for Backstage
MIT License
52 stars 29 forks source link

fix: use backstage fetch api instead of the default fetch for node js #180

Closed gomezcapg closed 8 months ago

gomezcapg commented 1 year ago

Context

Backstage provides a FetchApi to make requests this allows backstage users to create fetch customizations like automatic header injections. This Pr modifies the announcements plugin to use the backstage fetch api, making it compatible with any backstage implementation using any fetch api customization.

Changes

Additional Comments

The request object was removed as it was causing problems with the fetch api from backstage, the parameters were passed directly to the fetch call instead

const request = new Request(`${baseApiUrl}${input}`, {
      ...init,
      headers,
    });

Reference

Fetch Api Reference: https://backstage.io/docs/reference/core-plugin-api.fetchapi/

cursedcoder commented 1 year ago

hi @K-Phoen can you look into this?

kurtaking commented 11 months ago

@gomezcapg, I'd appreciate it if you opened this against this version. Otherwise, I will do it later this weekend.

K-Phoen commented 8 months ago

Merged, thanks :)