This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Common fetchAPI which can handle GET and POST method | |
| * Content-Type is set to 'application/json' | |
| * payload should be in JSON format | |
| */ | |
| export async function fetchAPI(url, data, method = 'POST') { | |
| // raise an error if url is missig | |
| if (!url) { | |
| throw new Error('url is missing'); | |
| } |