mirror of
https://github.com/codex-storage/codex-marketplace-ui.git
synced 2025-02-23 21:28:26 +00:00
Merge pull request #50 from codex-storage/releases/v0.0.5
Releases/v0.0.5
This commit is contained in:
commit
2a68573eb8
@ -15,7 +15,7 @@ import * as Sentry from "@sentry/react";
|
||||
import { CodexSdk } from "./sdk/codex";
|
||||
import { ErrorPlaceholder } from "./components/ErrorPlaceholder/ErrorPlaceholder.tsx";
|
||||
|
||||
if (import.meta.env.PROD) {
|
||||
if (import.meta.env.PROD && !import.meta.env.CI) {
|
||||
Sentry.init({
|
||||
release: "codex-storage-marketplace-ui@" + import.meta.env.PACKAGE_VERSION,
|
||||
dsn: "https://22d77c59a27b8d5efc07132188b505b9@o4507855852011520.ingest.de.sentry.io/4507866758512720",
|
||||
|
67
src/proxy.ts
67
src/proxy.ts
@ -3,7 +3,6 @@ import {
|
||||
CodexData,
|
||||
CodexDataResponse,
|
||||
CodexMarketplace,
|
||||
CodexReservation,
|
||||
SafeValue,
|
||||
UploadResponse,
|
||||
} from "@codex-storage/sdk-js";
|
||||
@ -143,39 +142,39 @@ class CodexMarketplaceMock extends CodexMarketplace {
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
override reservations(): Promise<SafeValue<CodexReservation[]>> {
|
||||
return Promise.resolve({
|
||||
error: false,
|
||||
data: [
|
||||
{
|
||||
id: "0x123456789",
|
||||
availabilityId: "0x12345678910",
|
||||
requestId: "0x1234567891011",
|
||||
/**
|
||||
* Size in bytes
|
||||
*/
|
||||
size: 500_000_000 + "",
|
||||
/**
|
||||
* Slot Index as hexadecimal string
|
||||
*/
|
||||
slotIndex: "2",
|
||||
},
|
||||
{
|
||||
id: "0x987654321",
|
||||
availabilityId: "0x9876543210",
|
||||
requestId: "0x98765432100",
|
||||
/**
|
||||
* Size in bytes
|
||||
*/
|
||||
size: 500_000_000 + "",
|
||||
/**
|
||||
* Slot Index as hexadecimal string
|
||||
*/
|
||||
slotIndex: "1",
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
// override reservations(): Promise<SafeValue<CodexReservation[]>> {
|
||||
// return Promise.resolve({
|
||||
// error: false,
|
||||
// data: [
|
||||
// {
|
||||
// id: "0x123456789",
|
||||
// availabilityId: "0x12345678910",
|
||||
// requestId: "0x1234567891011",
|
||||
// /**
|
||||
// * Size in bytes
|
||||
// */
|
||||
// size: 500_000_000 + "",
|
||||
// /**
|
||||
// * Slot Index as hexadecimal string
|
||||
// */
|
||||
// slotIndex: "2",
|
||||
// },
|
||||
// {
|
||||
// id: "0x987654321",
|
||||
// availabilityId: "0x9876543210",
|
||||
// requestId: "0x98765432100",
|
||||
// /**
|
||||
// * Size in bytes
|
||||
// */
|
||||
// size: 500_000_000 + "",
|
||||
// /**
|
||||
// * Slot Index as hexadecimal string
|
||||
// */
|
||||
// slotIndex: "1",
|
||||
// },
|
||||
// ],
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
export const CodexSdk = {
|
||||
|
@ -1,32 +1,18 @@
|
||||
import * as Sentry from "@sentry/browser";
|
||||
import { isCodexOnline } from "../components/NodeIndicator/NodeIndicator";
|
||||
import { CodexError } from "@codex-storage/sdk-js";
|
||||
|
||||
// It would be preferable to completely ignore the error
|
||||
// when the node is not connected. However, during the
|
||||
// initial load, we lack this information until the
|
||||
// SPR response is completed. In the meantime, other
|
||||
// requests may be initiated, so if the node is not
|
||||
// connected, we should set the level to 'log'.
|
||||
const getLogLevel = () => {
|
||||
switch (isCodexOnline) {
|
||||
case true:
|
||||
return "error";
|
||||
case null:
|
||||
return "info";
|
||||
case false:
|
||||
return "log";
|
||||
}
|
||||
};
|
||||
|
||||
export const Errors = {
|
||||
report(safe: { error: true, data: CodexError }) {
|
||||
if (safe.data.code === 502) {
|
||||
// Ignore Gateway error
|
||||
return
|
||||
}
|
||||
|
||||
Sentry.captureException(safe.data, {
|
||||
extra: {
|
||||
code: safe.data.code,
|
||||
errors: safe.data.errors,
|
||||
sourceStack: safe.data.sourceStack,
|
||||
level: getLogLevel(),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
1
src/vite-env.d.ts
vendored
1
src/vite-env.d.ts
vendored
@ -2,6 +2,7 @@
|
||||
|
||||
interface ImportMetaEnv {
|
||||
VITE_CODEX_API_URL: string;
|
||||
VITE_GEO_IP_URL: string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
|
Loading…
x
Reference in New Issue
Block a user