Skip to content

Instantly share code, notes, and snippets.

@Mozart409
Created August 12, 2020 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mozart409/9f20033ce13d30524c9bb2ce342e25eb to your computer and use it in GitHub Desktop.
Save Mozart409/9f20033ce13d30524c9bb2ce342e25eb to your computer and use it in GitHub Desktop.
React-Bricks Editor Error
react-bricks.cjs.production.min.js?cb9c:1 GET https://api.reactbricks.com/v1/admin/pages?type=&tag= 403 (Forbidden)
ae @ react-bricks.cjs.pro…ction.min.js?cb9c:1
eval @ react-bricks.cjs.pro…ction.min.js?cb9c:1
eval @ react-query.mjs?42ff:736
_catch @ react-query.mjs?42ff:316
eval @ react-query.mjs?42ff:734
eval @ react-query.mjs?42ff:335
eval @ react-query.mjs?42ff:822
_catch @ react-query.mjs?42ff:316
eval @ react-query.mjs?42ff:816
eval @ react-query.mjs?42ff:335
eval @ react-query.mjs?42ff:853
eval @ react-query.mjs?42ff:335
eval @ react-query.mjs?42ff:1338
_catch$2 @ react-query.mjs?42ff:1280
eval @ react-query.mjs?42ff:1337
eval @ react-query.mjs?42ff:1299
eval @ react-query.mjs?42ff:1383
commitHookEffectListMount @ react-dom.development.js?61bb:19731
commitPassiveHookEffects @ react-dom.development.js?61bb:19769
callCallback @ react-dom.development.js?61bb:188
invokeGuardedCallbackDev @ react-dom.development.js?61bb:237
invokeGuardedCallback @ react-dom.development.js?61bb:292
flushPassiveEffectsImpl @ react-dom.development.js?61bb:22853
unstable_runWithPriority @ scheduler.development.js?3069:653
runWithPriority$1 @ react-dom.development.js?61bb:11039
flushPassiveEffects @ react-dom.development.js?61bb:22820
performSyncWorkOnRoot @ react-dom.development.js?61bb:21737
eval @ react-dom.development.js?61bb:11089
unstable_runWithPriority @ scheduler.development.js?3069:653
runWithPriority$1 @ react-dom.development.js?61bb:11039
Promise.then (async)
asyncGeneratorStep @ asyncToGenerator.js?a954:13
_next @ asyncToGenerator.js?a954:25
eval @ asyncToGenerator.js?a954:32
eval @ asyncToGenerator.js?a954:21
change @ router.js:576
push @ router.ts?35b8:445
instance.<computed> @ router.ts?06ff:161
linkClicked @ link.tsx?5e4b:136
onClick @ link.tsx?5e4b:221
callCallback @ react-dom.development.js?61bb:188
invokeGuardedCallbackDev @ react-dom.development.js?61bb:237
invokeGuardedCallback @ react-dom.development.js?61bb:292
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js?61bb:306
executeDispatch @ react-dom.development.js?61bb:389
executeDispatchesInOrder @ react-dom.development.js?61bb:414
executeDispatchesAndRelease @ react-dom.development.js?61bb:3278
executeDispatchesAndReleaseTopLevel @ react-dom.development.js?61bb:3287
forEachAccumulated @ react-dom.development.js?61bb:3259
runEventsInBatch @ react-dom.development.js?61bb:3304
runExtractedPluginEventsInBatch @ react-dom.development.js?61bb:3514
handleTopLevel @ react-dom.development.js?61bb:3558
batchedEventUpdates$1 @ react-dom.development.js?61bb:21871
batchedEventUpdates @ react-dom.development.js?61bb:795
dispatchEventForLegacyPluginEventSystem @ react-dom.development.js?61bb:3568
attemptToDispatchEvent @ react-dom.development.js?61bb:4267
dispatchEvent @ react-dom.development.js?61bb:4189
unstable_runWithPriority @ scheduler.development.js?3069:653
runWithPriority$1 @ react-dom.development.js?61bb:11039
discreteUpdates$1 @ react-dom.development.js?61bb:21887
discreteUpdates @ react-dom.development.js?61bb:806
dispatchDiscreteEvent @ react-dom.development.js?61bb:4168
Show 34 more frames
@Mozart409
Copy link
Author

Mozart409 commented Aug 12, 2020

editor.js

import React from 'react'
import Head from 'next/head'
import { Admin, Editor } from 'react-bricks'

const AdminEditor = () => {
  return (
    <Admin>
      <Head>
        <title>Editor</title>
      </Head>
      <Editor />
    </Admin>
  )
}

export default AdminEditor

@Mozart409
Copy link
Author

config.js

import React from 'react'
import Link from 'next/link'
import Router, { useRouter } from 'next/router'
import pageTypeSchema from './pageTypeSchema'
import blockTypeSchema from './bricks'
import { appId, apiKey } from '../credentials.config'

const MyLink = ({
  href,
  children,
  className,
  activeClassName,
  isAdminHeader = true
}) => {
  const router = useRouter()

  let anchorClassName = ''

  if (router.pathname === href) {
    anchorClassName = activeClassName
  } else {
    anchorClassName = className
  }

  if (isAdminHeader) {
    return (
      <Link href={href}>
        <a className={anchorClassName}>{children}</a>
      </Link>
    )
  }
  return (
    <Link href='/[slug]' as={href}>
      <a className={anchorClassName}>{children}</a>
    </Link>
  )
}

const config = {
 /*  appId: process.env.appId,
  apiKey: process.env.apiKey, */
  appId,
  apiKey,
  pageTypeSchema,
  blockTypeSchema,
  logo: '/logo-beammeup-today.png',
  contentClassName: 'content',
  renderLocalLink: MyLink,
  navigate: path => Router.push(path)
}

export default config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment