todo-react-redux
todo-react-redux copied to clipboard
How can I make a task public?
I made a new page for all users tasks to be shown. I set the Firebase Rules Read to true to anyone can see them. Any advice to what I need to do to see everyones data ?
Can you show a sample of your rules?
I won't be at my computer until later tonight, but I set the read to tasks to true and write to false.
On Jul 9, 2017 12:34 AM, "Richard Park" [email protected] wrote:
Can you show a sample of your rules?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/r-park/todo-react-redux/issues/70#issuecomment-313902242, or mute the thread https://github.com/notifications/unsubscribe-auth/AUN_jNO_8xn-B5C-8W4EceixtTbfHyb-ks5sMHRtgaJpZM4OQeVu .
So what I'm trying to do is have people who are both authenticated and not authenticated to see tasks on the landing page. However it's still blank when I set permissions to true. I also tried to set just the path to tasks/ in the actions.js in the loadTasks () function. But the issue there is that it can't get past each individual authentication key. So I get an error there as well. What I'm thinking is that when I save a task I need to get rid of the authentication key and just save each record without it. If you know a solution that would be a big help!
In order to use path /tasks
to get all tasks, you would need to modify your rules to something like:
{
"rules": {
"tasks": {
".read": true,
"$uid": {
".read": true,
".write": "auth !== null && auth.uid === $uid",
".indexOn": ["completed"]
}
}
}
}
Okay cool. I will try that as soon as I can and let you know! Thanks
On Jul 9, 2017 3:46 PM, "Richard Park" [email protected] wrote:
In order to use path /tasks to get all tasks, you would need to modify your rules to something like:
{ "rules": { "tasks": { ".read": true,
"$uid": { ".read": true, ".write": "auth !== null && auth.uid === $uid", ".indexOn": ["completed"] } }
} }
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/r-park/todo-react-redux/issues/70#issuecomment-313967572, or mute the thread https://github.com/notifications/unsubscribe-auth/AUN_jORq2_DBJLh0Qp81zD0fT41erDVJks5sMUoWgaJpZM4OQeVu .
seems its still having trouble pulling the record even with indexOn: ["title"] The error im getting in the dev console is that " Cannot read property 'title' of null"
So I found that its pulling everyones data. But the record is 3 to 4 levels deep. Auth ID -> Record ID -> Data. Do you know of a way to loop twice through something within a render(){ I think it just needs to loop one more time?
+1 Were you ever able to do this? Where is that simulation results page?
I"m running this
ref.once('value', (snapshot) => {
console.log(snapshot);
console.log(snapshot.val());
....
in the firebase-list.js file with the firebase rules changed to what's above, but I'm still getting only the tasks from the user logged in.
I see I had to change taskList.path = '/all';
to taskList.path = '/tasks';
like @KillerBee05 . Where is this 'tasks' route decided?
Ok nvm. I think I understand what is going on here. I'll post what I did incase it helps anyone else. I created a new collection on firebase after I added it to the rules, and then pushed the tasks to that
firebaseDb.ref('/all')
.push(value, error => error ? reject(error) : resolve());
and then i can decide what the path is.
export function loadAllTasks(){
return (dispatch) => {
taskList.path = '/all';
console.log('load all')
console.log(taskList)
taskList.subscribe(dispatch);
}
}