JSFiddle - React, Tailwind, and code Playground
JavaScript
const currentUrl = window.location.href;
const hasCodeOrError = !!currentUrl
.split('&')
.map(entry => entry.split('='))
.find(([k]) => k === 'code' || k === 'error');
console.log(hasCodeOrError)
/* console.log(hasTokenOrError) */