Created
March 10, 2018 20:58
-
-
Save ShMcK/99cce63e3547b1bd7093f54aec9ece8d to your computer and use it in GitHub Desktop.
branch server
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
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