Skip to content

Instantly share code, notes, and snippets.

View jermsam's full-sized avatar
🎯
Focusing

Samson Ssali jermsam

🎯
Focusing
View GitHub Profile
@jermsam
jermsam / authentication.js
Created April 20, 2018 18:29
Feathers Social login
const authentication = require('@feathersjs/authentication');
const jwt = require('@feathersjs/authentication-jwt');
const local = require('@feathersjs/authentication-local');
const oauth2 = require('@feathersjs/authentication-oauth2');
const GithubStrategy = require('passport-github');
module.exports = function (app) {
const config = app.get('authentication');
// Set up authentication with the secret
@jermsam
jermsam / SigninPage.js
Created May 9, 2018 11:59
login state stuck at SERVICES_AUTHENTICATION_AUTHENTICATE_PENDING when fed with correct credentials yet validates ok when fed invalid credentials
import React,{Component} from 'react'
import PropTypes from 'prop-types'
import { compose } from 'recompose'
import {connect} from 'react-redux'
import {
withRouter,
} from 'react-router-dom';
import {
Divider, Message,Container
@jermsam
jermsam / App.js
Last active May 10, 2018 12:21
Cross-domain issue For the case where you are using feathers-reduxify-authentication and feathers-authentication-management
// CLIENT
// src/App.js
// other imports
import VerifySocialPage from './pages/VerifySocialPage'
function App () {
return (
<Switch>
// .... other routes
<Route path="/verify-social" exact component={VerifySocialPage} />
@jermsam
jermsam / LoginPage.js
Last active May 14, 2018 08:17
AUthUser Stays when I logout.
import React,{Component} from 'react'
import PropTypes from 'prop-types'
import { compose } from 'recompose'
import {connect} from 'react-redux'
import {
withRouter,
} from 'react-router-dom';
import {
Divider, Message,Container,Header
@jermsam
jermsam / User.js
Last active May 16, 2018 10:36
My this.props.history tends to get lost before it reaches my authenticated component
import React,{Component} from 'react'
import PropTypes from 'prop-types'
import {compose} from 'recompose'
import {connect} from 'react-redux'
import {
Divider, Message,Container
} from 'semantic-ui-react';
import { withRouter,} from 'react-router-dom'
import withAuthorization from './hocs/withAuthorization'
import SetUpProfile from './dashboardComponents/SetUpProfile'
import React , {Component} from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux';
import { compose } from 'recompose';
import {services} from '../../services'
class WithNetworks extends Component{
componentDidMount(){
const { findNetworks}=this.props
import React from 'react'
import { Input,Card,Statistic,Button } from 'semantic-ui-react'
import PropTypes from 'prop-types'
import WithStockQuantities from './WithStockQuantities'
function AirtimeCard ({card,name,logedIn}){
return (
@jermsam
jermsam / CreateProductForm.js
Last active July 12, 2018 18:11
How to integrate the RESTfull api with the react app
// src/CreateProductForm.js
import React, { Component } from 'react';
import { Form, Button} from 'semantic-ui-react';
import client from './feathers'
export default class CreateProductForm extends Component {
state = {
product:{
name:'',
description:'',
price:null
@jermsam
jermsam / channels.js
Created July 13, 2018 06:22
Enabling product is 'created' event to be emited for anonymous users
//add this to feather's src/channels.js around line 53
app.service(‘products’)
.publish(‘created’, () => app.channel(‘anonymous’));
@jermsam
jermsam / DisplayGrid.js
Last active July 19, 2018 11:30
Editing DisplayGrid to get notified when product is 'emitted' events are emited by remote end
// src/DisplayGrid.js
import React,{Component} from 'react'
import { Container,Divider,Header,Card,Button } from 'semantic-ui-react';
import {Link} from 'react-router-dom'
import client from './feathers'
export default class DisplayGrid extends Component {
state = {
products:[]
};