mirror of
https://github.com/discourse/discourse.git
synced 2025-09-08 12:06:51 +08:00
API endpoint for retrieving the current user
This commit is contained in:
parent
af5254d3b4
commit
1dac3cfd64
3 changed files with 29 additions and 0 deletions
|
@ -55,6 +55,14 @@ class SessionController < ApplicationController
|
|||
render json: {result: "ok"}
|
||||
end
|
||||
|
||||
def current
|
||||
if current_user.present?
|
||||
render_serialized(current_user, CurrentUserSerializer)
|
||||
else
|
||||
render nothing: true, status: 404
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
reset_session
|
||||
log_off_user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue