From: Jeff Davis Date: Wed, 29 Jul 2015 22:07:57 +0000 (-0700) Subject: Check for session token before accessing Library Account API X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6f17ad7685d98f9368bb1713b669c3413138507d;p=contrib%2Foverdrive-eg-opac.git Check for session token before accessing Library Account API This prevents a 404 error which can cause an "Authentication Required" popup to appear in Chrome. Signed-off-by: Jeff Davis --- diff --git a/src/od_api.coffee b/src/od_api.coffee index 7811f4c..a300c16 100644 --- a/src/od_api.coffee +++ b/src/od_api.coffee @@ -214,7 +214,15 @@ define [ # apiLibraryInfo: -> - get = -> od.api session.links.libraries.href + get = -> + if session.token.token_type? + od.api session.links.libraries.href + else + # We have no token of either kind. Let's default to getting + # a library access token. + od.apiDiscAccess() + .then get, logError + .then ok ok = (x) -> session.links.update x