Skip to content

Instantly share code, notes, and snippets.

View mikaelkaron's full-sized avatar

Mikael Karon mikaelkaron

View GitHub Profile
@mikaelkaron
mikaelkaron / hosts
Created February 27, 2024 14:00
hosts
127.0.0.1 localhost
127.0.0.1 local.maxm.se
import { OIDC_AUTH_HANDLERS, OIDC_AUTH_USER } from '@elivery/plugins/openid-auth';
import { FastifyPluginAsync, RegisterOptions, RouteOptions } from 'fastify';
import fp from 'fastify-plugin';
export const authRoutePlugin: FastifyPluginAsync<RegisterOptions> = fp(
async (fastify, options) => await fastify.register(async fastify => {
const {
[OIDC_AUTH_HANDLERS]: { login, logout, verify, refresh }
} = fastify
@mikaelkaron
mikaelkaron / machine.js
Created September 27, 2019 19:02
Generated by XState Viz: https://xstate.js.org/viz
// contrived example - reads from the `context` and sends
// the dynamically created event
const sendNameObjectFn = send((context, event) => ({
type: 'NAME',
name: context.user.name
}));
const sendNameObject = send({ type: 'NAME' });
const sendNameString = send('NAME');
@mikaelkaron
mikaelkaron / machine.js
Last active September 27, 2019 18:27
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@mikaelkaron
mikaelkaron / machine.js
Last active October 2, 2019 10:37
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@mikaelkaron
mikaelkaron / machine.js
Last active August 12, 2019 17:44
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@mikaelkaron
mikaelkaron / machine.js
Last active August 12, 2019 11:04
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@mikaelkaron
mikaelkaron / machine.js
Last active September 27, 2019 12:20
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@mikaelkaron
mikaelkaron / machine.ts
Created June 7, 2019 13:38
App XState machine with routing
// Available variables:
// Machine (machine factory function)
// assign (action)
// XState (all XState exports)
const send = XState.send;
const fetchMachine = Machine({
id: 'app',