fulcro 2018-03-29

you can just manually delegate to wrap-resouce and tell it the URI is index.html

but whatever 🙂

Ah ok, will try that instaed

@vijaykiran has joined the channel

Hi, I’m trying to get access to url query parameters on the client, I’m handling an oauth redirect back from an oauth provider. have the routing and server stuff working such that the callback url serves the main page and sets the route properly once the page/app initializes. would these just be like route params or something?

@eoliphant how do you want to access them?

URL query parameters are just JS stuff…nothing special

Well presumably in the page component

you can use js/window.location to get the stuff, there should be a goog.uri package to deal with the query params

ah just grab them with the regular js api

one other thing

the Closure library does have a lot of things to help with all sorts of stuff. worthwhile to read it, since it comes in for free

one quick thing, the ? got changed to a hash for some reason after the load

Fulcro itself doesn’t touch the history API or browser location

... even though the redirect had ‘?’ as one would expect

i believe the # and ? are two different things

maybe somethign in pushy/bidi

yeah they are

we also use # for tokens

i believe one of our libs adds the token with the # prepended

goog.History uses it

ok I may have lied lol. it may be an config thing.. stepping through it again, it looks like it is coming with the hash

which is weird

we store the auth token in local storage or it comes back from a login redirect after the # in then url

then we do this

(defn get-auth-token
  "Get JWT for authentication, first check uri hash then
  storage. Alse removes the token from the browser URL,
  if present."
  []
  (if (empty? (.getToken history))
    (.get storage "auth-token")
    (let [token (.getToken history)]
      (.setToken history "")
      (.set storage "auth-token" token)
      token)))

your setup is probably meant to do something similar?

@tony.kay have you ever tried to get source maps set up with advanced compilation?

im able to load source maps from the same location as the js file in prod, and chrome detects the source maps just fine, but they are blank when it tries to resolve the source link upon an exception

anyone else see that?

ask on #clojurescript

good idea

thanks @currentoor was planning to do somehting simiar.

@eoliphant this might help also

(ns arc.auth
  (:require-macros [arc.macros :refer [inspect]])
  (:require
   [fulcro.client.primitives :as prim]
   [goog.object :as o]
   [goog.storage.mechanism.mechanismfactory :as mech-factory])
  (:import
   [goog History]
   [goog.storage Storage]))

(defonce ^:private history (goog.History.))

(let [store-mech (mech-factory/create "arc/core")]
  (defonce ^:private storage (goog.storage.Storage. store-mech)))

and no worries simple_smile