Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of this - message:{'You are not subscribed to this API.'}.?

Tags:

reactjs

api

import React from 'react';
import './App.css';

function App() {
    fetch("https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/quickAnswer?q=How%20much%20vitamin%20c%20is%20in%202%20apples%253F", {
            "method": "GET",
            "headers": {
                "x-rapidapi-host": "[host]",
                "x-rapidapi-key": "[key]"
            }
        })
        .then(response => {
            console.log(response);
        })
        .catch(err => {
            console.log(err);
        });
    return ( <
        div className = "App" >
        <
        form className = 'searchform' >
        <
        input className = 'search-bar'
        type = "text" / >
        <
        button className = 'search-bar'
        type = 'text' > Submit < /button> < /
        form > <
        /div >
    );
}

export default App;
like image 599
Shahriar Avatar asked Apr 26 '20 18:04

Shahriar


1 Answers

if you have everything set up correct on RapidAPI I would suggest passing the key without using variables because maybe you are passing undefined. For undefined we get exactly the same error.

like image 97
Krystian Mateusiak Avatar answered Sep 21 '22 02:09

Krystian Mateusiak