codelab icon indicating copy to clipboard operation
codelab copied to clipboard

Create a button visible only to admins which would allow them to jump between prod (codelab.fun) and localhost

Open kirjs opened this issue 6 years ago • 2 comments
trafficstars

Add a new button to the list of buttons:

image

If the button is pressed on local environment, the user would be redirected to exactly the same page, but in prod, e.g. http://localhost:4200/angular/forms/built-in -> https://codelab.fun/angular/forms/built-in If the user is in prod, the user would be redirected to the local version https://codelab.fun/angular/forms/built-in -> http://localhost:4200/angular/forms/built-in

To make the button visible only for admins: use oldIsAdmin$ Observable from AccessService To only display the button for admins.

kirjs avatar Sep 06 '19 00:09 kirjs

Hello! I would like to try this once I have time :-)

duntee avatar Oct 10 '19 11:10 duntee

Go for it.

After some thought, sounds like this would be a bit hard to test.

As half of the data comes from FireBase, and the other half from location, I'd recommend writing a unit test mocking both and testing there.

Let me know if you get stuck at any point.

kirjs avatar Oct 10 '19 13:10 kirjs