Skip to content

Commit

Permalink
Merge pull request #42 from near-everything/fix/ipfs
Browse files Browse the repository at this point in the history
fix create
  • Loading branch information
elliotBraem authored Oct 6, 2024
2 parents f7982b4 + 2c92c59 commit 93d56fa
Show file tree
Hide file tree
Showing 2 changed files with 13,153 additions and 12,889 deletions.
9 changes: 6 additions & 3 deletions apps/canvas/widget/hyperfile/create.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const adapters = [
// },
{
title: "IPFS",
value: "everycanvas.near/widget/adapter.ipfs",
value: "efiz.near/widget/adapter.build-ipfs",
},
// {
// title: "GitHub",
Expand All @@ -66,7 +66,7 @@ const { creatorId } = props;

const [json, setJson] = useState(props.data ?? "");
const [source, setSource] = useState(props.source ?? "");
const [adapter, setAdapter] = useState(defaultAdapter.value ?? "");
const [adapter, setAdapter] = useState(defaultAdapter.value);
const [reference, setReference] = useState(undefined);
const [filename, setFilename] = useState(props.filename ?? "");
const [activeTab, setActiveTab] = useState("data");
Expand All @@ -81,12 +81,15 @@ function generateUID() {
);
}


const { create } = VM.require(adapter);

const handleCreate = (callback) => {
props.toggleModal();
const isCreator = context.accountId === creatorId;

// load in the state.adapter (modules for IPFS, Arweave, Ceramic, Verida, On Machina... )
const { create } = VM.require(adapter) || (() => {});

if (create) {
// store the data somewhere, based on the adapter
create(json).then((reference) => {
Expand Down
Loading

0 comments on commit 93d56fa

Please sign in to comment.