-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContactsExample.ts
More file actions
30 lines (28 loc) · 922 Bytes
/
ContactsExample.ts
File metadata and controls
30 lines (28 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import Contacts from "FuseJS/Contacts"
export default class ContactsExample {
message: string
addContact() {
Contacts.requestPermission()
.then(hasPermission => {
if (hasPermission) {
if (Contacts.addContact({
givenName: "Fuse X",
phoneNumbers: [{
label: "home",
number: "+1234567890"
}]
})) {
this.message = "Contact added!"
} else {
this.message = "Error occured"
}
} else {
this.message = "Permission denied"
}
})
.catch(reason => {
this.message = "Error occured"
console.error(reason)
})
}
}