Skip to content

Commit

Permalink
Update index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
daoauth committed Jul 16, 2024
1 parent cf8ac75 commit 926aadd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export const create = onRequest(async (req, res) => {
return;
}

const { network, project, provenance } = req.body as DocData;
const { name, network, project, provenance } = req.body as DocData;

if (!network || !project || !provenance) {
res
.status(400)
.send('Invalid input, missing "network", "project" or "provenance"');
.send('Invalid input, missing "name", "network", "project" or "provenance"');
return;
}

Expand All @@ -39,6 +39,7 @@ export const create = onRequest(async (req, res) => {
const firestore = admin.firestore();
const docRef = firestore.collection('unsigned').doc(uid);
await docRef.set({
name,
network,
project,
provenance,
Expand Down Expand Up @@ -109,13 +110,13 @@ const _load = async (
return;
}

const { network, project, provenance, serializedSignedTx } =
const { name, network, project, provenance, serializedSignedTx } =
doc.data() as DocData;
if (collection === 'signed') {
await docRef.delete();
res.status(200).json({ network, serializedSignedTx });
res.status(200).json({ name, network, serializedSignedTx });
} else {
res.status(200).json({ network, project, provenance });
res.status(200).json({ name, network, project, provenance });
}
} catch (error) {
console.error(`Error reading and deleting data from ${collection}:`, error);
Expand Down

0 comments on commit 926aadd

Please sign in to comment.