diff --git a/app/routes/profile-generator.jsx b/app/routes/profile-generator.jsx index 9ff6bb4..111090c 100644 --- a/app/routes/profile-generator.jsx +++ b/app/routes/profile-generator.jsx @@ -29,27 +29,13 @@ import HandleError from '~/components/HandleError' export async function action({ request }) { let formData = await request.formData() - let rawData = {} + let data = {} for (let key of formData.keys()) { - const values = formData.getAll(key) - - // Deal with multiple values submitted as an array - if (key.endsWith('[]')) { - const keyWithoutBrackets = key.slice(0, -2) - - if (values.length === 1) { - rawData[keyWithoutBrackets] = [] - rawData[keyWithoutBrackets].push(...values) - } else { - rawData[keyWithoutBrackets] = values - } - - delete rawData[key] - } else { - rawData[key] = values.length > 1 ? values : values[0] + if (key !== '_action') { + data[key] = formData.getAll(key) } } - let { _action, ...data } = rawData + const _action = formData.get('_action') let schema, profileId, profileTitle, @@ -61,7 +47,7 @@ export async function action({ request }) { profileIpfsHash switch (_action) { case 'submit': - schema = await parseRef(data.linked_schemas) + schema = await parseRef(data.linked_schemas[0]) profile = await generateInstance(schema, data) response = await fetchJsonPost( process.env.PUBLIC_INDEX_URL + '/v2/validate', diff --git a/package-lock.json b/package-lock.json index 9d4568d..9eb6e99 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "GPLv3", "dependencies": { - "@murmurations/jsig": "^1.0.0", + "@murmurations/jsig": "^1.0.1", "@murmurations/jsrfg": "^1.0.0", "@remix-run/react": "^1.18.1", "@vercel/node": "^2.15.3", @@ -2636,9 +2636,9 @@ "dev": true }, "node_modules/@murmurations/jsig": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@murmurations/jsig/-/jsig-1.0.0.tgz", - "integrity": "sha512-MzZjtUih9lJ6HELEe0RcRqhEe+mWX+mxpRAICb/s6Yxv/5W/V3bIIKGxIsK5+qlVkGmgOgqGb5PSx47lxW5uTg==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@murmurations/jsig/-/jsig-1.0.1.tgz", + "integrity": "sha512-1s68/jLrfVG/G0OmNLJ+lX5PwiE/YdESUyJoz5YwsrgjywaX07hIx+4oLIjHG/AyKMhK8OA6Lc6RyzYm/U5zlg==", "dependencies": { "@apidevtools/json-schema-ref-parser": "^10.1.0" } @@ -16947,9 +16947,9 @@ "dev": true }, "@murmurations/jsig": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@murmurations/jsig/-/jsig-1.0.0.tgz", - "integrity": "sha512-MzZjtUih9lJ6HELEe0RcRqhEe+mWX+mxpRAICb/s6Yxv/5W/V3bIIKGxIsK5+qlVkGmgOgqGb5PSx47lxW5uTg==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@murmurations/jsig/-/jsig-1.0.1.tgz", + "integrity": "sha512-1s68/jLrfVG/G0OmNLJ+lX5PwiE/YdESUyJoz5YwsrgjywaX07hIx+4oLIjHG/AyKMhK8OA6Lc6RyzYm/U5zlg==", "requires": { "@apidevtools/json-schema-ref-parser": "^10.1.0" } diff --git a/package.json b/package.json index 52d6813..ee66ca1 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ ] }, "dependencies": { - "@murmurations/jsig": "^1.0.0", + "@murmurations/jsig": "^1.0.1", "@murmurations/jsrfg": "^1.0.0", "@remix-run/react": "^1.18.1", "@vercel/node": "^2.15.3",