Skip to content

Instantly share code, notes, and snippets.

@fredriccliver
Last active September 7, 2020 04:07
Show Gist options
  • Save fredriccliver/af9b04fb65dd1538a1b1dd1cd8dde112 to your computer and use it in GitHub Desktop.
Save fredriccliver/af9b04fb65dd1538a1b1dd1cd8dde112 to your computer and use it in GitHub Desktop.
let functions = firebase.functions()
functions.useFunctionsEmulator('http://localhost:5001')
let btn = document.querySelector("#btn-get-data")
let label = document.querySelector("#label")
let retrieveData = functions.httpsCallable("retrieve")
btn.addEventListener("click", (e) => {
retrieveData()
.then((res) => {
label.innerHTML = res.data
console.log("successfully retrieved")
})
.catch((e) => console.log(e))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment