Is it possible to change my endpoint conditionally? I'm trying to change my endpoint according to an id, if the id is 1 to fetch endpoint1 and if the id is 2 to fetch endpoint 2, but it always returns an error, here is the code:
if type.state == 1 {
let response = fetch('https://myapp.com/1',
} else {
let response = fetch('https://myapp.com/2', {
});
Aucun commentaire:
Enregistrer un commentaire