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
| import Vue from 'vue' | |
| import VueApollo from 'vue-apollo' | |
| import { | |
| createApolloClient, | |
| restartWebsockets | |
| } from 'vue-cli-plugin-apollo/graphql-client' | |
| // Install the vue plugin | |
| Vue.use(VueApollo) |
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
| <template> | |
| <Span v-bind:class="classes + ' ' + type" v-bind:text="getIcon()" /> | |
| </template> | |
| <script> | |
| /* | |
| Setup: | |
| 1. Setup CSS and Font in Native Script App like this: | |
| https://medium.com/@JCAguilera/fontawesome-5-and-nativescript-22653f2b3bac | |
| Thanks > Juanky Aguilera |
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 ApplicationController < ActionController::API | |
| include ActionController::MimeResponds | |
| respond_to :json | |
| 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
| Rails.application.config.middleware.insert_before 0, Rack::Cors do | |
| allow do | |
| origins '*' | |
| resource '*', | |
| headers: %w(Authorization), | |
| methods: :any, | |
| expose: %w(Authorization), | |
| max_age: 600 | |
| 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
| Rails.application.routes.draw do | |
| devise_for :users, | |
| path: '', | |
| path_names: { | |
| sign_in: 'login', | |
| sign_out: 'logout' | |
| }, | |
| controllers: { | |
| sessions: 'sessions', |
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 |
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
| Devise.setup do |config| | |
| # Add this at the end of the config block | |
| config.jwt do |jwt| | |
| jwt.secret = ENV['DEVISE_JWT_SECRET'] | |
| jwt.dispatch_requests = [ | |
| ['POST', %r{^/login$}] | |
| ] | |
| jwt.revocation_requests = [ | |
| ['DELETE', %r{^/logout$}] |
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
| 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 CreateJwtBlacklists < ActiveRecord::Migration[5.2] | |
| def change | |
| create_table :jwt_blacklist do |t| | |
| t.string :jti, null: false | |
| t.datetime :exp, null: false | |
| end | |
| add_index :jwt_blacklist, :jti | |
| end | |
| end |