Fork me on GitHub
#fulcro
<
2018-03-29
>
tony.kay01:03:32

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

tony.kay01:03:37

but whatever 🙂

eoliphant04:03:33

Ah ok, will try that instaed

eoliphant18:03:41

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?

currentoor18:03:49

@eoliphant how do you want to access them?

tony.kay18:03:29

URL query parameters are just JS stuff…nothing special

eoliphant18:03:03

Well presumably in the page component

currentoor18:03:17

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

eoliphant18:03:24

ah just grab them with the regular js api

eoliphant18:03:36

one other thing

tony.kay18:03:53

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

eoliphant18:03:31

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

tony.kay18:03:04

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

eoliphant18:03:31

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

currentoor18:03:39

i believe the # and ? are two different things

eoliphant18:03:40

maybe somethign in pushy/bidi

eoliphant18:03:46

yeah they are

currentoor18:03:52

we also use # for tokens

currentoor18:03:09

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

currentoor18:03:34

goog.History uses it

eoliphant18:03:34

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

eoliphant18:03:38

which is weird

currentoor18:03:12

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

currentoor18:03:24

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)))

currentoor18:03:50

your setup is probably meant to do something similar?

currentoor18:03:24

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

currentoor18:03:15

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

currentoor18:03:28

anyone else see that?

tony.kay18:03:32

ask on #clojurescript

eoliphant19:03:04

thanks @currentoor was planning to do somehting simiar.

currentoor19:03:40

@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)))

currentoor19:03:48

and no worries simple_smile