Skip to content

Commit 13a23fc

Browse files
CryptedData: use id provided by api
1 parent be031ee commit 13a23fc

5 files changed

Lines changed: 12 additions & 12 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fw-processing",
3-
"version": "0.0.1",
3+
"version": "0.2.4",
44
"packageManager": "pnpm@7.15.0",
55
"private": true,
66
"scripts": {

packages/import/features/Import.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect } from 'react';
22

33
import { useAppSelector, useAppDispatch, setRowData } from 'state';
4-
import { selectJsonSchema, selectCryptedData, setCryptedData, selectUiSchema, setJsonSchema, setUiSchema } from 'project-state';
4+
import { selectJsonSchema, selectCryptedData, setCryptedData, selectUiSchema, setJsonSchema, setUiSchema, CryptedData } from 'project-state';
55
import { PGPProvider, decryptUsingContext } from 'pgp-provider';
66
import { api } from '@formswizard/api';
77

@@ -30,12 +30,13 @@ export function DecryptAndImportLastNewSubmission() {
3030

3131
/** TODO: Delete decrypted dataset after import and loop over submissions **/
3232

33-
const { data, uuid, keyId, armoredPublicKey } = cryptedData[cryptedData.length-1] || {};
33+
const cryptedDatum = cryptedData[cryptedData.length-1] || {} as CryptedData;
34+
const { id, data, keyId, armoredPublicKey } = cryptedDatum
3435
const decrypted_str = decryptUsingContext(data);
3536
const decrypted = decrypted_str && JSON.parse(decrypted_str);
3637

3738
useEffect( () => {
38-
const row = { ...decrypted, id: uuid, uuid, keyId, armoredPublicKey }
39+
const row = { ...decrypted, id, keyId, armoredPublicKey }
3940
decrypted && dispatch(setRowData({row}));
4041
}, [decrypted]);
4142

packages/import/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "import",
3-
"version": "0.0.0",
3+
"version": "0.2.4",
44
"license": "MIT",
55
"scripts": {
66
"lint": "eslint \"**/*.ts*\"",
@@ -17,7 +17,7 @@
1717
"typescript": "^5.2.2"
1818
},
1919
"dependencies": {
20-
"@formswizard/api": "^0.2.1",
20+
"@formswizard/api": "^0.2.4",
2121
"@types/react": "^18.2.21",
2222
"pgp-provider": "workspace:*",
2323
"project-state": "workspace:*",

packages/project-state/features/slices/cryptedDataSlice.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit";
22
import { RootState } from "../state/store";
33

44
type ArmoredPGPMessage = string;
5-
type UUID = string;
65
type PGPID = string;
76
type ArmoredPubKey = string;
87

98
export interface CryptedData {
109
data: ArmoredPGPMessage
11-
uuid: UUID,
10+
id: string,
1211
keyId: PGPID,
1312
armoredPublicKey: ArmoredPubKey
1413
}

pnpm-lock.yaml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)