Add unregister feature to topcoder challenge page

Key Information

Register
Submit
The challenge is finished.

Challenge Overview

For this challenge, we want to add an "unregister" feature to the challenge details page. This functionality should be as follows:

- We will not add a new button to the page, but rather repurpose the existing registration button under certain conditions.
- When the user is not logged in, or is not registered, or the challenge is not in the registration phase, everything should function as it does now.
- When the user is logged in, registered, and the challenge is in the registration phase (and only during the phase!), the "register" button should become an unregister button that allows the user to unregister for the challenge.
- The "unregister" button should use the endpoint api.topcoder.com/v2/challenges/<challenge ID>/unregister, which currently works.
- Show a confirmation message when the user successfully unregisters (similar to how we show a message when a user successfully registers).

To test out the endpoint, make a POST request to the endpoint with an "Authorization" header with the contents "Bearer <contents of tcjwt cookie>". For your code changes, you should match the style of how we do this kind of thing in other cases (i.e., create and use a service).

Final Submission Guidelines

You should submit a patch against the tc-site repo.

Your code style should generally match what's already in the challenge details module.

ELIGIBLE EVENTS:

2017 TopCoder(R) Open

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30055170