forked from getmeli/meli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): Display invite links on the staff page
This adds the invitation URL to the server response for invitations and it then leverages that URL on the client. The hope here is to address issue getmeli#247 and ideally just make it easier to use Meli without having to have a working email server to send out invites. Design note: I very deliberately pass a URL back from the server instead of just the bare token. The reason is that if I pass back a bare token then the UI will have to formulate the URL which means duplicating that logic both client and server side which I have a visceral dislike for (very bad code smell, IMHO). This way, only the server needs to know how to construct the URLs and it can unilaterally change the scheme if it wants with _zero_ impact on the client. Hypermedia for the win.
- Loading branch information
Showing
4 changed files
with
28 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import { inviteUrl } from './handlers/invites/add-invite'; | ||
import { Invite } from './invite'; | ||
|
||
export function serializeInvite(invite: Invite) { | ||
return { | ||
_id: invite._id, | ||
email: invite.email, | ||
expiresAt: invite.expiresAt, | ||
url: inviteUrl(invite), | ||
memberOptions: invite.memberOptions, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters