Skip to content

Instantly share code, notes, and snippets.

@defrex
defrex / AuthClient.ts
Last active June 27, 2020 22:39
Nhost Auth & Apollo integrated with Next.js
import fetch from 'cross-fetch'
import jwtDecode from 'jwt-decode'
import moment from 'moment'
import { NextPageContext } from 'next'
import { destroyCookie, parseCookies, setCookie } from 'nookies'
export class AuthClient {
baseUrl = 'https://backend-[whatev].nhost.app'
stateChangeCallbacks: (() => void)[] = []
context?: NextPageContext