Pretty fix

This commit is contained in:
David Négrier 2021-12-06 18:20:06 +01:00
parent c27662c315
commit 84f7a8c383
4 changed files with 18 additions and 19 deletions

View File

@ -1,10 +1,10 @@
import * as rax from 'retry-axios';
import * as rax from "retry-axios";
import Axios from "axios";
import { CONTACT_URL, PUSHER_URL, DISABLE_ANONYMOUS, OPID_LOGIN_SCREEN_PROVIDER } from "../Enum/EnvironmentVariable";
import type { CharacterTexture } from "./LocalUser";
import { localUserStore } from "./LocalUserStore";
import axios from "axios";
import {axiosWithRetry} from "./AxiosUtils";
import { axiosWithRetry } from "./AxiosUtils";
export class MapDetail {
constructor(public readonly mapUrl: string, public readonly textures: CharacterTexture[] | undefined) {}

View File

@ -270,7 +270,7 @@ export class GameScene extends DirtyScene {
// So if we are in https, we can still try to load a HTTP local resource (can be useful for testing purposes)
// See https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts#when_is_a_context_considered_secure
const base = new URL(window.location.href);
base.pathname = '';
base.pathname = "";
const url = new URL(file.src, base.toString());
const host = url.host.split(":")[0];
if (

View File

@ -107,10 +107,7 @@ export class ErrorScene extends Phaser.Scene {
} else if (Axios.isAxiosError(error)) {
// Axios HTTP error
// client never received a response, or request never left
console.error(
"Axios error. No full HTTP response received. Request to URL:",
error.config.url
);
console.error("Axios error. No full HTTP response received. Request to URL:", error.config.url);
scene.start(ErrorSceneName, {
title: "Network error",
subTitle: error.message,

View File

@ -1,7 +1,7 @@
import {derived, writable} from "svelte/store";
import { derived, writable } from "svelte/store";
interface ErrorMessage {
id: string|undefined;
id: string | undefined;
closable: boolean; // Whether it can be closed by a user action or not
message: string | number | boolean | undefined;
}
@ -14,10 +14,13 @@ function createErrorStore() {
return {
subscribe,
addErrorMessage: (e: string | Error, options?: {
closable?: boolean,
id?: string
}): void => {
addErrorMessage: (
e: string | Error,
options?: {
closable?: boolean;
id?: string;
}
): void => {
update((messages: ErrorMessage[]) => {
let message: string;
if (e instanceof Error) {
@ -26,11 +29,11 @@ function createErrorStore() {
message = e;
}
if (!messages.find(errorMessage => errorMessage.message === message)) {
if (!messages.find((errorMessage) => errorMessage.message === message)) {
messages.push({
message,
closable: options?.closable ?? true,
id: options?.id
id: options?.id,
});
}
@ -39,13 +42,13 @@ function createErrorStore() {
},
clearMessageById: (id: string): void => {
update((messages: ErrorMessage[]) => {
messages = messages.filter(message => message.id !== id);
messages = messages.filter((message) => message.id !== id);
return messages;
});
},
clearClosableMessages: (): void => {
update((messages: ErrorMessage[]) => {
messages = messages.filter(message => message.closable);
messages = messages.filter((message) => message.closable);
return messages;
});
},
@ -54,8 +57,7 @@ function createErrorStore() {
export const errorStore = createErrorStore();
export const hasClosableMessagesInErrorStore = derived(errorStore, ($errorStore) => {
const closableMessage = $errorStore.find(errorMessage => errorMessage.closable);
const closableMessage = $errorStore.find((errorMessage) => errorMessage.closable);
return !!closableMessage;
});