-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52b40c7
commit c51fe47
Showing
2 changed files
with
34 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package handler | ||
|
||
import ( | ||
"encoding/json" | ||
"net/http" | ||
|
||
"github.com/shigde/sfu/internal/auth" | ||
"github.com/shigde/sfu/internal/rest" | ||
) | ||
|
||
func DeleteAccount(accountService *auth.AccountService) http.HandlerFunc { | ||
|
||
return func(w http.ResponseWriter, r *http.Request) { | ||
w.Header().Set("Content-Type", "application/json") | ||
user, err := getJsonAuthPayload(w, r) | ||
if err != nil { | ||
rest.HttpError(w, "", http.StatusBadRequest, err) | ||
return | ||
} | ||
|
||
token, err := accountService.GetAuthToken(r.Context(), user) | ||
if err != nil { | ||
rest.HttpError(w, "error reading stream list", http.StatusNotFound, err) | ||
return | ||
} | ||
if err := json.NewEncoder(w).Encode(token); err != nil { | ||
rest.HttpError(w, "error reading stream list", http.StatusInternalServerError, err) | ||
} | ||
} | ||
} |
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