Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions app/controllers/api/contents_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Api
class ContentsController < ApplicationController
skip_before_action :verify_authenticity_token

def index
if current_user
contents = current_user.contents.order(stream: :asc)
render json: { contents: }
else
render json: { message: 'ログインしてください' }
end
end
end
end
4 changes: 4 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@
resources :flags, only: %i[create destroy]
resources :notifications, only: %i[create]
end

namespace :api do
resources :contents, only: [:index]
end
end