Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I make a task public? #70

Open
KillerBee05 opened this issue Jul 7, 2017 · 11 comments
Open

How can I make a task public? #70

KillerBee05 opened this issue Jul 7, 2017 · 11 comments

Comments

@KillerBee05
Copy link

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 ?

@r-park
Copy link
Owner

r-park commented Jul 9, 2017

Can you show a sample of your rules?

@KillerBee05
Copy link
Author

KillerBee05 commented Jul 9, 2017 via email

@KillerBee05
Copy link
Author

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!

@r-park
Copy link
Owner

r-park commented Jul 9, 2017

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"]
      }
    }
  }
}

@KillerBee05
Copy link
Author

KillerBee05 commented Jul 9, 2017 via email

@KillerBee05
Copy link
Author

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"

image
image

image

image

@KillerBee05
Copy link
Author

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?

image

@Tzikas
Copy link

Tzikas commented Oct 12, 2017

+1 Were you ever able to do this? Where is that simulation results page?

@Tzikas
Copy link

Tzikas commented Oct 18, 2017

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.

@Tzikas
Copy link

Tzikas commented Oct 18, 2017

I see I had to change taskList.path = '/all'; to taskList.path = '/tasks'; like @KillerBee05 . Where is this 'tasks' route decided?

@Tzikas
Copy link

Tzikas commented Oct 18, 2017

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);

	} 
	
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants