Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • kszk/devteam/kszkepzes/old/kszkepzes-frontend
  • kbgergely/kszkepzes-frontend
2 results
Show changes
/* eslint-disable no-param-reassign */
/* eslint-disable no-use-before-define */
// In production, we register a service worker to serve assets from local cache. // In production, we register a service worker to serve assets from local cache.
// This lets the app load faster on subsequent visits in production, and gives // This lets the app load faster on subsequent visits in production, and gives
...@@ -46,7 +48,7 @@ export default function register() { ...@@ -46,7 +48,7 @@ export default function register() {
function registerValidSW(swUrl) { function registerValidSW(swUrl) {
navigator.serviceWorker navigator.serviceWorker
.register(swUrl) .register(swUrl)
.then(registration => { .then((registration) => {
registration.onupdatefound = () => { registration.onupdatefound = () => {
const installingWorker = registration.installing; const installingWorker = registration.installing;
installingWorker.onstatechange = () => { installingWorker.onstatechange = () => {
...@@ -67,7 +69,7 @@ function registerValidSW(swUrl) { ...@@ -67,7 +69,7 @@ function registerValidSW(swUrl) {
}; };
}; };
}) })
.catch(error => { .catch((error) => {
console.error('Error during service worker registration:', error); console.error('Error during service worker registration:', error);
}); });
} }
...@@ -75,14 +77,14 @@ function registerValidSW(swUrl) { ...@@ -75,14 +77,14 @@ function registerValidSW(swUrl) {
function checkValidServiceWorker(swUrl) { function checkValidServiceWorker(swUrl) {
// Check if the service worker can be found. If it can't reload the page. // Check if the service worker can be found. If it can't reload the page.
fetch(swUrl) fetch(swUrl)
.then(response => { .then((response) => {
// Ensure service worker exists, and that we really are getting a JS file. // Ensure service worker exists, and that we really are getting a JS file.
if ( if (
response.status === 404 || response.status === 404 ||
response.headers.get('content-type').indexOf('javascript') === -1 response.headers.get('content-type').indexOf('javascript') === -1
) { ) {
// No service worker found. Probably a different app. Reload the page. // No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => { navigator.serviceWorker.ready.then((registration) => {
registration.unregister().then(() => { registration.unregister().then(() => {
window.location.reload(); window.location.reload();
}); });
...@@ -101,7 +103,7 @@ function checkValidServiceWorker(swUrl) { ...@@ -101,7 +103,7 @@ function checkValidServiceWorker(swUrl) {
export function unregister() { export function unregister() {
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => { navigator.serviceWorker.ready.then((registration) => {
registration.unregister(); registration.unregister();
}); });
} }
......
const { createProxyMiddleware } = require("http-proxy-middleware");
module.exports = function (app) {
app.use(
"/api",
createProxyMiddleware({
target: "http://localhost:8000",
changeOrigin: true,
}),
);
app.use(
"/admin",
createProxyMiddleware({
target: "http://localhost:8000",
changeOrigin: true,
}),
);
app.use(
"/staticfiles",
createProxyMiddleware({
target: "http://localhost:8000",
changeOrigin: true,
}),
);
app.use(
"/mediafiles",
createProxyMiddleware({
target: "http://localhost:8000",
changeOrigin: true,
}),
);
app.use(
"/oidc",
createProxyMiddleware({
target: "http://localhost:8000",
changeOrigin: true,
}),
);
};
Source diff could not be displayed: it is too large. Options to address this: view the blob.