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 / machine.js
Created April 4, 2021 15:36
Generated by XState Viz: https://xstate.js.org/viz
const passwordlessAuth = Machine({
id: 'passwordless',
initial: 'requestPhase',
context: {
phone: '',
hash:'',
otp:''
},
// main - states
// incase you want your custom nextjs modules to be imported as absolute paths
require('dotenv').config()
const path = require('path');
module.exports ={
env:{
MY_STEP:process.env.MY_STEP
},
serverRuntimeConfig: {
@jermsam
jermsam / logout.js
Last active June 10, 2020 21:29
logout http only nextApiResponse
import { NextApiRequest, NextApiResponse, } from "next"
import {serialize} from 'cookie'
export default async (req:NextApiRequest, res:NextApiResponse) => {
res.statusCode = 200
console.log(req.statusCode)
if(req.method==='POST'){
cccccc
cccccc
@jermsam
jermsam / authentication.js
Created May 15, 2019 15:23
my aouth flow as of now
const authentication = require('@feathersjs/authentication');
const jwt = require('@feathersjs/authentication-jwt');
const oauth2 = require('@feathersjs/authentication-oauth2');
const GoogleStrategy = require('passport-google-oauth20');
const EmailFirstOAuth2Verifier = require('./verifier');
// Bring in the oauth-handler
const makeHandler = require('./oauth-handler');
const callbackHook = hook => {
return async (req, res, next) => {
// track all authentication for the whole app at the very ancestor. then pass it on to all children
export default class MyApp extends App {
static async getInitialProps({ Component, ctx }) {
let pageProps = {}
if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx)
import React, { Component, createRef } from 'react';
import {
Menu,
Modal,
Header,
Button,
Icon,
Loader,
Container
} from 'semantic-ui-react';
app
.service('stories')
.find()
.then(({ data }) =>
data.map(({ title, goal, user }) => {
console.log(user);
if (user) {
const { id, avatar, firstname, lastname } = user;
return {
id,
@jermsam
jermsam / feathers.js
Last active May 1, 2019 14:28
anything wrong?
/* eslint-disable no-console */
import feathers from '@feathersjs/client';
import io from 'socket.io-client';
// require('dotenv').config();
const url =
process.env.NODE_ENV === 'production'
? 'https://tvillage-s.herokuapp.com'