ngx-rendering-service-lib 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78,12 +78,13 @@ const handleSessionRequest = async (request) => {
78
78
  */
79
79
  const handleRenderDataRequest = async (request) => {
80
80
  const response = await fetch(request)
81
- const dbRequest = buildDbRequest()
82
- if (dbRequest !== undefined) {
83
- const existingSessionId = await retrieveSessionIdFromDb(dbRequest)
81
+ const dbRequestGet = buildDbRequest()
82
+ const dbRequestWrite = buildDbRequest()
83
+ if (dbRequestGet !== undefined && dbRequestWrite !== undefined) {
84
+ const existingSessionId = await retrieveSessionIdFromDb(dbRequestGet)
84
85
  const newSessionId = response.headers.get(SESSION_HEADER_NAME)
85
86
  if (newSessionId !== null && newSessionId !== "" && newSessionId !== existingSessionId) {
86
- await storeSessionIdToDb(dbRequest, newSessionId)
87
+ await storeSessionIdToDb(dbRequestWrite, newSessionId)
87
88
  }
88
89
  }
89
90
  return response
@@ -176,7 +177,7 @@ const retrieveSessionIdFromDb = (dbRequest) => {
176
177
  const store = transaction.objectStore(DB_STORE)
177
178
  const idQuery = store.get(1)
178
179
  idQuery.onsuccess = () => {
179
- result = idQuery.result.sessionId
180
+ result = idQuery.result !== undefined ? idQuery.result.sessionId : ""
180
181
  }
181
182
  idQuery.onerror = () => {
182
183
  console.error("Query by id failed")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-rendering-service-lib",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "tslib": "^2.3.0"