Fix prettier issues
This commit is contained in:
parent
bc17b86ce4
commit
91e8fa7cd4
@ -8,17 +8,10 @@
|
|||||||
import logoImg from "../images/logo-min-white.png";
|
import logoImg from "../images/logo-min-white.png";
|
||||||
let logo = gameManager?.currentStartedRoom?.loginSceneLogo ?? logoImg;
|
let logo = gameManager?.currentStartedRoom?.loginSceneLogo ?? logoImg;
|
||||||
import reload from "../images/reload.png";
|
import reload from "../images/reload.png";
|
||||||
import external from "../images/external-link.png";
|
|
||||||
import { connectionManager } from "../../Connexion/ConnectionManager";
|
|
||||||
|
|
||||||
let errorScreen = get(errorScreenStore);
|
let errorScreen = get(errorScreenStore);
|
||||||
|
|
||||||
function click() {
|
function click() {
|
||||||
if (errorScreen.urlToRedirect) {
|
window.location.reload();
|
||||||
if (errorScreen.urlToRedirect === "/login") void connectionManager.logout();
|
|
||||||
else window.location.assign(errorScreen.urlToRedirect);
|
|
||||||
} else if (errorScreen.type === "redirect" && window.history.length > 2) history.back();
|
|
||||||
else window.location.reload();
|
|
||||||
}
|
}
|
||||||
let details = errorScreen.details;
|
let details = errorScreen.details;
|
||||||
let timeVar = errorScreen.timeToRetry ?? 0;
|
let timeVar = errorScreen.timeToRetry ?? 0;
|
||||||
@ -31,7 +24,7 @@
|
|||||||
onDestroy(() => clearInterval(interval));
|
onDestroy(() => clearInterval(interval));
|
||||||
}
|
}
|
||||||
|
|
||||||
$: detailsStylized = details.replace("{time}", `${timeVar / 1000}`);
|
$: detailsStylized = (details ?? "").replace("{time}", `${timeVar / 1000}`);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main class="errorScreen" transition:fly={{ y: -200, duration: 500 }}>
|
<main class="errorScreen" transition:fly={{ y: -200, duration: 500 }}>
|
||||||
@ -44,9 +37,9 @@
|
|||||||
<p class="details">
|
<p class="details">
|
||||||
{detailsStylized}{#if $errorScreenStore.type === "retry"}<div class="loading" />{/if}
|
{detailsStylized}{#if $errorScreenStore.type === "retry"}<div class="loading" />{/if}
|
||||||
</p>
|
</p>
|
||||||
{#if ($errorScreenStore.type === "retry" && $errorScreenStore.canRetryManual) || ($errorScreenStore.type === "unauthorized" && $errorScreenStore.urlToRedirect && $errorScreenStore.buttonTitle) || ($errorScreenStore.type === "redirect" && (window.history.length > 2 || $errorScreenStore.urlToRedirect))}
|
{#if $errorScreenStore.type === "retry" && $errorScreenStore.canRetryManual}
|
||||||
<button type="button" class="nes-btn is-primary button" on:click={click}>
|
<button type="button" class="nes-btn is-primary button" on:click={click}>
|
||||||
<img src={$errorScreenStore.type === "retry" ? reload : external} alt="" class="reload" />
|
<img src={reload} alt="" class="reload" />
|
||||||
{$errorScreenStore.buttonTitle}
|
{$errorScreenStore.buttonTitle}
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 10 KiB |
@ -49,9 +49,9 @@ export class EntryScene extends Scene {
|
|||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
const errorType = isErrorApiData.safeParse(err?.response?.data);
|
const errorType = isErrorApiData.safeParse(err?.response?.data);
|
||||||
if (errorType.success) {
|
if (errorType.success) {
|
||||||
if (errorType.data.type === 'unauthorized') {
|
if (errorType.data.type === "unauthorized") {
|
||||||
void connectionManager.logout();
|
void connectionManager.logout();
|
||||||
} else if (errorType.data.type === 'redirect') {
|
} else if (errorType.data.type === "redirect") {
|
||||||
window.location.assign(errorType.data.urlToRedirect);
|
window.location.assign(errorType.data.urlToRedirect);
|
||||||
} else errorScreenStore.setError(err?.response?.data);
|
} else errorScreenStore.setError(err?.response?.data);
|
||||||
} else {
|
} else {
|
||||||
|
@ -10,7 +10,7 @@ function createErrorScreenStore() {
|
|||||||
return {
|
return {
|
||||||
subscribe,
|
subscribe,
|
||||||
setError: (e: ErrorScreenMessage): void => {
|
setError: (e: ErrorScreenMessage): void => {
|
||||||
set(e)
|
set(e);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -43,9 +43,4 @@ export const isErrorApiData = z.discriminatedUnion("type", [
|
|||||||
isErrorApiUnauthorizedData,
|
isErrorApiUnauthorizedData,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export type ErrorApiErrorData = z.infer<typeof isErrorApiErrorData>;
|
|
||||||
export type ErrorApiRetryData = z.infer<typeof isErrorApiRetryData>;
|
|
||||||
export type ErrorApiRedirectData = z.infer<typeof isErrorApiRedirectData>;
|
|
||||||
export type ErrorApiUnauthorizedData = z.infer<typeof isErrorApiUnauthorizedData>;
|
|
||||||
|
|
||||||
export type ErrorApiData = z.infer<typeof isErrorApiData>;
|
export type ErrorApiData = z.infer<typeof isErrorApiData>;
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/thecodingmachine/workadventure#readme",
|
"homepage": "https://github.com/thecodingmachine/workadventure#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@anatine/zod-openapi": "^1.3.0",
|
||||||
"axios": "^0.21.2",
|
"axios": "^0.21.2",
|
||||||
"circular-json": "^0.5.9",
|
"circular-json": "^0.5.9",
|
||||||
"debug": "^4.3.1",
|
"debug": "^4.3.1",
|
||||||
@ -48,6 +49,7 @@
|
|||||||
"hyper-express": "^5.8.1",
|
"hyper-express": "^5.8.1",
|
||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^8.5.1",
|
||||||
"mkdirp": "^1.0.4",
|
"mkdirp": "^1.0.4",
|
||||||
|
"openapi3-ts": "^2.0.2",
|
||||||
"openid-client": "^4.7.4",
|
"openid-client": "^4.7.4",
|
||||||
"prom-client": "^12.0.0",
|
"prom-client": "^12.0.0",
|
||||||
"qs": "^6.10.3",
|
"qs": "^6.10.3",
|
||||||
|
@ -247,7 +247,6 @@ export class IoSocketController {
|
|||||||
const IPAddress = req.getHeader("x-forwarded-for");
|
const IPAddress = req.getHeader("x-forwarded-for");
|
||||||
const locale = req.getHeader("accept-language");
|
const locale = req.getHeader("accept-language");
|
||||||
|
|
||||||
|
|
||||||
const roomId = query.roomId;
|
const roomId = query.roomId;
|
||||||
try {
|
try {
|
||||||
if (typeof roomId !== "string") {
|
if (typeof roomId !== "string") {
|
||||||
@ -345,7 +344,7 @@ export class IoSocketController {
|
|||||||
reason: null,
|
reason: null,
|
||||||
status: 500,
|
status: 500,
|
||||||
message: err?.response?.data,
|
message: err?.response?.data,
|
||||||
roomId: roomId
|
roomId: roomId,
|
||||||
} as UpgradeFailedData,
|
} as UpgradeFailedData,
|
||||||
websocketKey,
|
websocketKey,
|
||||||
websocketProtocol,
|
websocketProtocol,
|
||||||
|
@ -59,9 +59,10 @@ import {
|
|||||||
ErrorApiData,
|
ErrorApiData,
|
||||||
isErrorApiErrorData,
|
isErrorApiErrorData,
|
||||||
isErrorApiRedirectData,
|
isErrorApiRedirectData,
|
||||||
isErrorApiRetryData, isErrorApiUnauthorizedData
|
isErrorApiRetryData,
|
||||||
|
isErrorApiUnauthorizedData,
|
||||||
} from "../Messages/JsonMessages/ErrorApiData";
|
} from "../Messages/JsonMessages/ErrorApiData";
|
||||||
import {BoolValue, Int32Value, StringValue} from "google-protobuf/google/protobuf/wrappers_pb";
|
import { BoolValue, Int32Value, StringValue } from "google-protobuf/google/protobuf/wrappers_pb";
|
||||||
|
|
||||||
const debug = Debug("socket");
|
const debug = Debug("socket");
|
||||||
|
|
||||||
@ -681,20 +682,22 @@ export class SocketManager implements ZoneEventListener {
|
|||||||
public emitErrorScreenMessage(client: compressors.WebSocket, errorApi: ErrorApiData) {
|
public emitErrorScreenMessage(client: compressors.WebSocket, errorApi: ErrorApiData) {
|
||||||
const errorMessage = new ErrorScreenMessage();
|
const errorMessage = new ErrorScreenMessage();
|
||||||
errorMessage.setType(errorApi.type);
|
errorMessage.setType(errorApi.type);
|
||||||
if(errorApi.type == 'retry' || errorApi.type == 'error'){
|
if (errorApi.type == "retry" || errorApi.type == "error") {
|
||||||
errorMessage.setCode(new StringValue().setValue(errorApi.code));
|
errorMessage.setCode(new StringValue().setValue(errorApi.code));
|
||||||
errorMessage.setTitle(new StringValue().setValue(errorApi.title));
|
errorMessage.setTitle(new StringValue().setValue(errorApi.title));
|
||||||
errorMessage.setSubtitle(new StringValue().setValue(errorApi.subtitle));
|
errorMessage.setSubtitle(new StringValue().setValue(errorApi.subtitle));
|
||||||
errorMessage.setDetails(new StringValue().setValue(errorApi.details));
|
errorMessage.setDetails(new StringValue().setValue(errorApi.details));
|
||||||
errorMessage.setImage(new StringValue().setValue(errorApi.image));
|
errorMessage.setImage(new StringValue().setValue(errorApi.image));
|
||||||
}
|
}
|
||||||
if(errorApi.type == 'retry') {
|
if (errorApi.type == "retry") {
|
||||||
if (errorApi.buttonTitle) errorMessage.setButtontitle(new StringValue().setValue(errorApi.buttonTitle));
|
if (errorApi.buttonTitle) errorMessage.setButtontitle(new StringValue().setValue(errorApi.buttonTitle));
|
||||||
if (errorApi.canRetryManual !== undefined) errorMessage.setCanretrymanual(new BoolValue().setValue(errorApi.canRetryManual));
|
if (errorApi.canRetryManual !== undefined)
|
||||||
if (errorApi.timeToRetry) errorMessage.setTimetoretry(new Int32Value().setValue(Number(errorApi.timeToRetry)));
|
errorMessage.setCanretrymanual(new BoolValue().setValue(errorApi.canRetryManual));
|
||||||
|
if (errorApi.timeToRetry)
|
||||||
|
errorMessage.setTimetoretry(new Int32Value().setValue(Number(errorApi.timeToRetry)));
|
||||||
}
|
}
|
||||||
if(errorApi.type == 'redirect' && errorApi.urlToRedirect) errorMessage.setUrltoredirect(new StringValue().setValue(errorApi.urlToRedirect));
|
if (errorApi.type == "redirect" && errorApi.urlToRedirect)
|
||||||
|
errorMessage.setUrltoredirect(new StringValue().setValue(errorApi.urlToRedirect));
|
||||||
|
|
||||||
const serverToClientMessage = new ServerToClientMessage();
|
const serverToClientMessage = new ServerToClientMessage();
|
||||||
serverToClientMessage.setErrorscreenmessage(errorMessage);
|
serverToClientMessage.setErrorscreenmessage(errorMessage);
|
||||||
|
Loading…
Reference in New Issue
Block a user