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

Friendly url #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Friendly url #7

wants to merge 2 commits into from

Conversation

Ana06
Copy link
Contributor

@Ana06 Ana06 commented Jul 13, 2018

Align pad URL with pad title. For that it was needed to:

  • Save the pad title when creating it
  • Rename the paramether in the route fron id to name
  • Use the name in the route to call getObjectNames which allow us to get the id
  • Some ugly parsing to get the id, due to the format of the response. See: Pad friendly URL #1 (comment) 🙈

This will allow us to use the pad title in the url of the pad instead of
the id, but still be able to identify it with the id.
Rename the paramether in the route fron `id` to `name` to have
friendly urls. Use the name in the route to call `getObjectNames` which
allow us to get the id. The result need an ugly parsing to get the id,
due to the format of the response. See:
SwellRT#1 (comment)

Closes SwellRT#1.
}
init(name) {
// get the id from the name
this.swellService.getObjectNames(name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to encapsulate the "get object id from name" logic in a method of swellService?

@@ -47,7 +47,7 @@ export class HomeComponent implements OnInit, OnDestroy {
this.swellService.getObject(name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing trailing ;

@@ -47,7 +47,7 @@ export class HomeComponent implements OnInit, OnDestroy {
this.swellService.getObject(name)
.then( object => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swellService.getObject(objectId) requires a id as parameter, not a name. This code creates an object with id == name

Copy link
Contributor

@pablojan pablojan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes break the current logic to open/create objects (sorry, surely it was not clear enough).

HomeComponent:

  • Gets a pad (object) name from user input.
  • Checks whether this name correspond with an existing pad (for example a method swellService.getObjectIdByName()).
    If not, creates a new object (with autogenerated id) and assing it the name
  • Redirect to pad/:name
  • To be considered: are we going to pass the object name as is as URL part?

PadComponent:

  • gets the name from URL and invoque padService.init(name)

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

Successfully merging this pull request may close these issues.

None yet

2 participants