Skip to content

Instantly share code, notes, and snippets.

@ShMcK
Created March 10, 2018 20:58
Show Gist options
  • Save ShMcK/99cce63e3547b1bd7093f54aec9ece8d to your computer and use it in GitHub Desktop.
Save ShMcK/99cce63e3547b1bd7093f54aec9ece8d to your computer and use it in GitHub Desktop.
branch server
class DeepLink {
constructor(branchKey) {
this.key = branchKey;
this.url = 'https://api.branch.io/v1/url';
}
request(data) {
return fetch(this.url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
branch_key: this.key,
duration: 604800, // 7 days
data,
}),
})
.then(res => res.json())
.catch(onError);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment