-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTODO
42 lines (37 loc) · 1018 Bytes
/
TODO
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
31
32
33
34
35
36
37
38
39
40
41
42
- aggiungiamo react navigation
- aggiungiamo login form
- integrazione con firebase authentication
- creazione screen TodoCreate.js
- creazione new todoCreate action:
export const todoCreate = ({ name, location, duedate, navigateBack }) => {
const { currentUser } = firebase.auth();
return (dispatch) => {
firebase.database().ref(`/users/${currentUser.uid}/todolist`)
.push({ name, phone, shift })
.then(() => {
dispatch({ type: TODO_CREATED });
navigateBack();
})
}
};
- lettura todolist da firebase
export const employeesFetch = () => {
const { currentUser } = firebase.auth();
return (dispatch) => {
firebase.database().ref(`/users/${currentUser.uid}/todolist`)
.on('value', snapshot => {
dispatch({ type: TODOLIST_FETCH_SUCCESS, payload: snapshot.val()})
})
}
};
aggiungere regole di sicurezza a firebase
- {
"rules": {
"users": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}