Skip to content

Commit

Permalink
update templates
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed Mar 20, 2024
1 parent c059684 commit 994f024
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 126 deletions.
4 changes: 2 additions & 2 deletions templates/react/packages/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const App = () => {

checkbox.disabled = true;
try {
await toggleTask(task.key.key);
await toggleTask(task.key.id);
} finally {
checkbox.disabled = false;
}
Expand All @@ -51,7 +51,7 @@ export const App = () => {
const button = event.currentTarget;
button.disabled = true;
try {
await deleteTask(task.key.key);
await deleteTask(task.key.id);
} finally {
button.disabled = false;
}
Expand Down
10 changes: 5 additions & 5 deletions templates/react/packages/client/src/mud/createSystemCalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ export function createSystemCalls(
await waitForTransaction(tx);
};

const toggleTask = async (key: Hex) => {
const isComplete = (useStore.getState().getValue(tables.Tasks, { key })?.completedAt ?? 0n) > 0n;
const tx = isComplete ? await worldContract.write.resetTask([key]) : await worldContract.write.completeTask([key]);
const toggleTask = async (id: Hex) => {
const isComplete = (useStore.getState().getValue(tables.Tasks, { id })?.completedAt ?? 0n) > 0n;
const tx = isComplete ? await worldContract.write.resetTask([id]) : await worldContract.write.completeTask([id]);
await waitForTransaction(tx);
};

const deleteTask = async (key: Hex) => {
const tx = await worldContract.write.deleteTask([key]);
const deleteTask = async (id: Hex) => {
const tx = await worldContract.write.deleteTask([id]);
await waitForTransaction(tx);
};

Expand Down
Loading

0 comments on commit 994f024

Please sign in to comment.