mirror of
https://github.com/logos-storage/logos-storage-marketplace-ui.git
synced 2026-01-02 13:33:06 +00:00
Remove useless shortcut
This commit is contained in:
parent
0b66e55016
commit
18cffa0e02
@ -38,8 +38,8 @@ export function AvailabilityReservations({
|
||||
error,
|
||||
} = useQuery({
|
||||
queryFn: () =>
|
||||
CodexSdk.marketplace()
|
||||
.reservations(availability!.id)
|
||||
CodexSdk.client()
|
||||
.marketplace.reservations(availability!.id)
|
||||
.then((s) => Promises.rejectOnError(s)),
|
||||
queryKey: ["reservations"],
|
||||
|
||||
|
||||
@ -33,8 +33,8 @@ export function useAvailabilityMutation(
|
||||
input: Omit<AvailabilityState, "totalSizeUnit" | "durationUnit">
|
||||
) => Promise<"" | CodexAvailability> = input.id
|
||||
? (input) => {
|
||||
return CodexSdk.marketplace()
|
||||
.updateAvailability({
|
||||
return CodexSdk.client()
|
||||
.marketplace.updateAvailability({
|
||||
totalSize: input.totalSize,
|
||||
duration: input.duration,
|
||||
minPricePerBytePerSecond: input.minPricePerBytePerSecond,
|
||||
@ -44,8 +44,8 @@ export function useAvailabilityMutation(
|
||||
.then((s) => Promises.rejectOnError(s));
|
||||
}
|
||||
: (input) =>
|
||||
CodexSdk.marketplace()
|
||||
.createAvailability(input)
|
||||
CodexSdk.client()
|
||||
.marketplace.createAvailability(input)
|
||||
.then((s) => Promises.rejectOnError(s));
|
||||
|
||||
return fn({
|
||||
|
||||
@ -26,8 +26,8 @@ type Props = {
|
||||
export function FileDetails({ onClose, details }: Props) {
|
||||
const { data: purchases = [] } = useQuery({
|
||||
queryFn: () =>
|
||||
CodexSdk.marketplace()
|
||||
.purchases()
|
||||
CodexSdk.client()
|
||||
.marketplace.purchases()
|
||||
.then(async (res) => {
|
||||
if (res.error) {
|
||||
return res;
|
||||
|
||||
@ -17,8 +17,8 @@ export function LogLevel() {
|
||||
const [level, setLevel] = useState<CodexLogLevel>("DEBUG");
|
||||
const { mutateAsync, isPending } = useMutation({
|
||||
mutationFn: (level: CodexLogLevel) =>
|
||||
CodexSdk.debug()
|
||||
.setLogLevel(level)
|
||||
CodexSdk.client()
|
||||
.debug.setLogLevel(level)
|
||||
.then((s) => Promises.rejectOnError(s)),
|
||||
onSuccess: () => {
|
||||
setToast({
|
||||
|
||||
@ -11,8 +11,8 @@ export function ManifestFetch() {
|
||||
|
||||
const { refetch } = useQuery({
|
||||
queryFn: () => {
|
||||
CodexSdk.data()
|
||||
.networkDownload(cid)
|
||||
CodexSdk.client()
|
||||
.data.networkDownload(cid)
|
||||
.then((s) => {
|
||||
if (s.error === false) {
|
||||
setCid("");
|
||||
@ -21,8 +21,8 @@ export function ManifestFetch() {
|
||||
return Promises.rejectOnError(s);
|
||||
});
|
||||
|
||||
return CodexSdk.data()
|
||||
.fetchManifest(cid)
|
||||
return CodexSdk.client()
|
||||
.data.fetchManifest(cid)
|
||||
.then((s) => {
|
||||
if (s.error === false) {
|
||||
setCid("");
|
||||
|
||||
@ -15,8 +15,8 @@ const defaultSpace = {
|
||||
export function NodeSpace() {
|
||||
const { data: space, isPending } = useQuery({
|
||||
queryFn: () =>
|
||||
CodexSdk.data()
|
||||
.space()
|
||||
CodexSdk.client()
|
||||
.data.space()
|
||||
.then((s) => Promises.rejectOnError(s)),
|
||||
queryKey: ["space"],
|
||||
initialData: defaultSpace,
|
||||
|
||||
@ -23,8 +23,8 @@ export function PurchasesTable() {
|
||||
const content = useData();
|
||||
const { data, isPending } = useQuery({
|
||||
queryFn: () =>
|
||||
CodexSdk.marketplace()
|
||||
.purchases()
|
||||
CodexSdk.client()
|
||||
.marketplace.purchases()
|
||||
.then((s) => Promises.rejectOnError(s)),
|
||||
queryKey: ["purchases"],
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ export function StorageRequestFileChooser({
|
||||
editable={false}
|
||||
multiple={false}
|
||||
onDeleteItem={onDelete}
|
||||
codexData={CodexSdk.data()}
|
||||
codexData={CodexSdk.client().data}
|
||||
successMessage={"Success, the CID has been copied to the field on top."}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -18,8 +18,8 @@ export function useStorageRequestMutation(
|
||||
|
||||
const { mutateAsync } = useMutation({
|
||||
mutationFn: (input: CodexCreateStorageRequestInput) =>
|
||||
CodexSdk.marketplace()
|
||||
.createStorageRequest(input)
|
||||
CodexSdk.client()
|
||||
.marketplace.createStorageRequest(input)
|
||||
.then((s) => Promises.rejectOnError(s)),
|
||||
onSuccess: async () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["purchases"] });
|
||||
|
||||
@ -16,7 +16,7 @@ export function UploadCard() {
|
||||
<main>
|
||||
<Upload
|
||||
multiple
|
||||
codexData={CodexSdk.data()}
|
||||
codexData={CodexSdk.client().data}
|
||||
onSuccess={onSuccess}
|
||||
Icon={() => <UploadIcon width={40} color={"#96969666"} />}
|
||||
/>
|
||||
|
||||
@ -8,8 +8,8 @@ export function useCodexConnection() {
|
||||
const { data, isError, isFetching, refetch } = useQuery({
|
||||
queryKey: ["spr"],
|
||||
queryFn: async () => {
|
||||
return CodexSdk.node()
|
||||
.spr()
|
||||
return CodexSdk.client()
|
||||
.node.spr()
|
||||
.then((data) => Promises.rejectOnError(data, report));
|
||||
},
|
||||
refetchInterval: 5000,
|
||||
|
||||
@ -8,8 +8,8 @@ export function useData() {
|
||||
const { data = { content: [] } satisfies CodexDataResponse } =
|
||||
useQuery<CodexDataResponse>({
|
||||
queryFn: () =>
|
||||
CodexSdk.data()
|
||||
.cids()
|
||||
CodexSdk.client()
|
||||
.data.cids()
|
||||
.then((res) => Promises.rejectOnError(res)),
|
||||
queryKey: ["cids"],
|
||||
|
||||
|
||||
@ -6,8 +6,8 @@ export function useDebug(throwOnError: boolean) {
|
||||
const { data, isError, isPending, refetch, isSuccess, isFetching } = useQuery(
|
||||
{
|
||||
queryFn: () =>
|
||||
CodexSdk.debug()
|
||||
.info()
|
||||
CodexSdk.client()
|
||||
.debug.info()
|
||||
.then((s) => Promises.rejectOnError(s)),
|
||||
|
||||
queryKey: ["debug"],
|
||||
|
||||
@ -8,8 +8,8 @@ export function usePersistence(isCodexOnline: boolean) {
|
||||
const { data, isError, isFetching, refetch } = useQuery({
|
||||
queryKey: [],
|
||||
queryFn: async () => {
|
||||
return CodexSdk.marketplace()
|
||||
.activeSlots()
|
||||
return CodexSdk.client()
|
||||
.marketplace.activeSlots()
|
||||
.then((data) => Promises.rejectOnError(data, report));
|
||||
},
|
||||
|
||||
|
||||
@ -33,7 +33,6 @@ class CodexMarketplaceMock extends CodexMarketplace {
|
||||
override async createStorageRequest(
|
||||
input: CodexCreateStorageRequestInput
|
||||
): Promise<SafeValue<string>> {
|
||||
console.info(input);
|
||||
const res = await super.createStorageRequest(input);
|
||||
|
||||
if (res.error) {
|
||||
|
||||
@ -34,15 +34,15 @@ export function AvailabilitiesRoute() {
|
||||
AvailabilityWithSlots[]
|
||||
>({
|
||||
queryFn: () =>
|
||||
CodexSdk.marketplace()
|
||||
.availabilities()
|
||||
CodexSdk.client()
|
||||
.marketplace.availabilities()
|
||||
.then((s) => Promises.rejectOnError(s))
|
||||
.then((res) => res.sort((a, b) => b.totalSize - a.totalSize))
|
||||
.then((data) =>
|
||||
Promise.all(
|
||||
data.map((a) =>
|
||||
CodexSdk.marketplace()
|
||||
.reservations(a.id)
|
||||
CodexSdk.client()
|
||||
.marketplace.reservations(a.id)
|
||||
.then((res) => {
|
||||
if (res.error) {
|
||||
Errors.report(res);
|
||||
@ -85,8 +85,8 @@ export function AvailabilitiesRoute() {
|
||||
// Error will be catched in ErrorBounday
|
||||
const { data: space = defaultSpace } = useQuery({
|
||||
queryFn: () =>
|
||||
CodexSdk.data()
|
||||
.space()
|
||||
CodexSdk.client()
|
||||
.data.space()
|
||||
.then((s) => Promises.rejectOnError(s)),
|
||||
queryKey: ["space"],
|
||||
initialData: defaultSpace,
|
||||
|
||||
@ -45,4 +45,8 @@
|
||||
.input input {
|
||||
--codex-input-background-color: rgba(35, 35, 35, 1);
|
||||
}
|
||||
|
||||
.basic-auth-checkbox {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,10 @@ export const CodexSdk = {
|
||||
return url;
|
||||
},
|
||||
|
||||
client() {
|
||||
return client;
|
||||
},
|
||||
|
||||
async load() {
|
||||
const [
|
||||
u = import.meta.env.VITE_CODEX_API_URL,
|
||||
@ -42,7 +46,7 @@ export const CodexSdk = {
|
||||
url = u;
|
||||
|
||||
const promises = [WebStorage.set("codex-node-url", url)];
|
||||
console.info(url);
|
||||
|
||||
if (options.auth) {
|
||||
const { username, password } = options.auth;
|
||||
basicAuthSecret = btoa(`${username}:${password}`);
|
||||
@ -62,20 +66,4 @@ export const CodexSdk = {
|
||||
|
||||
return Promise.all(promises);
|
||||
},
|
||||
|
||||
debug() {
|
||||
return client.debug;
|
||||
},
|
||||
|
||||
data() {
|
||||
return client.data;
|
||||
},
|
||||
|
||||
node() {
|
||||
return client.node;
|
||||
},
|
||||
|
||||
marketplace() {
|
||||
return client.marketplace;
|
||||
},
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user