From cab6c3f011059c240ba7b1000619081a9e4cf048 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Mon, 23 Sep 2019 14:08:24 +0200
Subject: [PATCH] Use getAssetURL() from common

---
 packages/auth/assets/index.html    | 2 +-
 packages/auth/src/utils.js         | 9 ---------
 packages/auth/src/vpu-auth-demo.js | 4 ++--
 packages/auth/src/vpu-auth.js      | 4 ++--
 packages/auth/vendor/common        | 2 +-
 5 files changed, 6 insertions(+), 15 deletions(-)
 delete mode 100644 packages/auth/src/utils.js

diff --git a/packages/auth/assets/index.html b/packages/auth/assets/index.html
index f96300c0..83305f4f 100644
--- a/packages/auth/assets/index.html
+++ b/packages/auth/assets/index.html
@@ -2,7 +2,7 @@
 <html>
 <head>
     <meta charset="UTF-8">
-    <script type="module" id="vpu-auth-wc-src" src="bundle.js"></script>
+    <script type="module" id="vpu-auth-src" src="bundle.js"></script>
 </head>
 
 <body>
diff --git a/packages/auth/src/utils.js b/packages/auth/src/utils.js
deleted file mode 100644
index 2b6ad588..00000000
--- a/packages/auth/src/utils.js
+++ /dev/null
@@ -1,9 +0,0 @@
-export const getAssetURL = (path) => {
-    const elm = document.getElementById('vpu-library-app-src');
-    if (!elm)
-        return path;
-    const url = elm.src;
-    // newer browsers only
-    //var url = import.meta.url;
-    return new URL(path, url).href;
-};
diff --git a/packages/auth/src/vpu-auth-demo.js b/packages/auth/src/vpu-auth-demo.js
index 7558824b..7bb3997f 100644
--- a/packages/auth/src/vpu-auth-demo.js
+++ b/packages/auth/src/vpu-auth-demo.js
@@ -3,7 +3,6 @@ import {html, LitElement} from 'lit-element';
 import './vpu-auth';
 import * as commonUtils from 'vpu-common/utils';
 import bulmaCSSPath from "bulma/css/bulma.min.css";
-import * as utils from "./utils";
 
 class AuthDemo extends LitElement {
     constructor() {
@@ -28,7 +27,8 @@ class AuthDemo extends LitElement {
     }
 
     render() {
-        const bulmaCSS = utils.getAssetURL(bulmaCSSPath);
+        commonUtils.initAssetBaseURL('vpu-auth-src');
+        const bulmaCSS = commonUtils.getAssetURL(bulmaCSSPath);
         return html`
             <link rel="stylesheet" href="${bulmaCSS}">
 
diff --git a/packages/auth/src/vpu-auth.js b/packages/auth/src/vpu-auth.js
index 632e60e2..1bfcb4c1 100644
--- a/packages/auth/src/vpu-auth.js
+++ b/packages/auth/src/vpu-auth.js
@@ -4,7 +4,6 @@ import JSONLD from 'vpu-common/jsonld'
 import * as commonUtils from 'vpu-common/utils';
 import 'vpu-common/vpu-icon.js';
 import bulmaCSSPath from "bulma/css/bulma.min.css";
-import * as utils from "./utils";
 
 /**
  * Keycloak auth web component
@@ -298,7 +297,8 @@ class VPUAuth extends LitElement {
     }
 
     render() {
-        const bulmaCSS = utils.getAssetURL(bulmaCSSPath);
+        commonUtils.initAssetBaseURL('vpu-auth-src');
+        const bulmaCSS = commonUtils.getAssetURL(bulmaCSSPath);
         return html`
             <link rel="stylesheet" href="${bulmaCSS}">
 
diff --git a/packages/auth/vendor/common b/packages/auth/vendor/common
index 91947464..adbdf637 160000
--- a/packages/auth/vendor/common
+++ b/packages/auth/vendor/common
@@ -1 +1 @@
-Subproject commit 91947464b55c79c5b0aa2188f512e08ebc0be612
+Subproject commit adbdf63736ba48eaf93ca06f83ee3652b7f85f12
-- 
GitLab