Skip to content

Commit

Permalink
scope to /
Browse files Browse the repository at this point in the history
  • Loading branch information
sergesoroka committed Oct 5, 2024
1 parent ff091e1 commit 833f2b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ console.log("base url", base_url);
if ("serviceWorker" in navigator) {
window.addEventListener("load", () => {
navigator.serviceWorker
.register(base_url, { scope: "/search" })
.register(base_url, { scope: "/" })
.then((registration) => {
console.log(
"Service Worker registered with scope: ",
Expand Down
19 changes: 19 additions & 0 deletions utils/base64.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// src/utils/base64.js

// Function to decode base64 string and convert it to a Blob
export function base64ToBlob(base64, contentType = "", sliceSize = 512) {
const byteCharacters = atob(base64);
const byteArrays = [];

for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
const slice = byteCharacters.slice(offset, offset + sliceSize);
const byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}

return new Blob(byteArrays, { type: contentType });
}

0 comments on commit 833f2b6

Please sign in to comment.