This file contains hidden or 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
| class ToDoBox < React::Component::Base | |
| param :todos, type: Array | |
| def add_todo(body) | |
| $store.dispatch({ | |
| type: :add_todo, | |
| id: 1, | |
| body: body | |
| }) | |
| end |
This file contains hidden or 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
| class ToDoStore | |
| attr_reader :state | |
| def initialize(initial_state = nil) | |
| @state = initial_state | |
| @listeners = [] | |
| dispatch({}) | |
| end | |
| def dispatch(action) |
This file contains hidden or 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
| def add_todo(body) | |
| $store.dispatch({ | |
| type: :add_todo, | |
| id: 1, | |
| body: body | |
| }) | |
| end |
This file contains hidden or 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
| require 'opal' | |
| require 'jquery' | |
| require 'opal-jquery' | |
| require 'json' | |
| require 'react-latest' | |
| require 'reactrb' | |
| require 'todo' | |
| require 'todo_store' |
This file contains hidden or 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
| return ( | |
| <section className="discover"> | |
| <DiscoverHeader /> | |
| {!isAdvancedSearchVisible && <DiscoverForm actions={actions} />} | |
| {isAdvancedSearchVisible && <DiscoverAdvancedForm actions={actions} />} | |
| {projectsWeLove.size !== 0 | |
| && projects.size === 0 | |
| && !wasSearchPerformed | |
| && <DiscoverProjectsWeLove actions={actions} />} | |
| {!wasSearchPerformed && topProjectsHTML} |
This file contains hidden or 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
| class User < ApplicationRecord | |
| devise :database_authenticatable, | |
| :jwt_authenticatable, | |
| jwt_revocation_strategy: JWTBlacklist | |
| end |
This file contains hidden or 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
| class CreateJwtBlacklist < ActiveRecord::Migration[5.0] | |
| def change | |
| create_table :jwt_blacklist do |t| | |
| t.string :jti, null: false | |
| end | |
| add_index :jwt_blacklist, :jti | |
| end | |
| end |
This file contains hidden or 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
| class JWTBlacklist < ApplicationRecord | |
| include Devise::JWT::RevocationStrategies::Blacklist | |
| self.table_name = 'jwt_blacklist' | |
| end |
This file contains hidden or 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
| config.jwt do |jwt| | |
| jwt.secret = ENV['DEVISE_JWT_SECRET_KEY'] | |
| jwt.dispatch_requests = [ | |
| ['POST', %r{^/login$}] | |
| ] | |
| jwt.revocation_requests = [ | |
| ['DELETE', %r{^/logout$}] | |
| ] | |
| jwt.expiration_time = 1.day.to_i | |
| end |
This file contains hidden or 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
| class SessionsController < Devise::SessionsController | |
| respond_to :json | |
| private | |
| def respond_with(resource, _opts = {}) | |
| render json: resource | |
| end | |
| def respond_to_on_destroy |