mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-09 20:28:29 +03:00
Merge pull request #550 from filecoin-project/@akuokojnr/upload-to-slate
fix: broken file upload to slate on slate page
This commit is contained in:
commit
8c67e06706
@ -2,7 +2,7 @@ import * as Strings from "~/common/strings";
|
||||
|
||||
// NOTE(jim):
|
||||
// Recursion for nested entities (any number).
|
||||
export const getCurrentById = (targetId) => {
|
||||
export const getCurrent = ({ id, data }) => {
|
||||
let target = null;
|
||||
let activeIds = {};
|
||||
|
||||
@ -11,6 +11,10 @@ export const getCurrentById = (targetId) => {
|
||||
if (state[i].id === id) {
|
||||
target = state[i];
|
||||
activeIds[state[i].id] = true;
|
||||
|
||||
if (target.id === "NAV_SLATE") {
|
||||
target.slateId = data && data.id;
|
||||
}
|
||||
}
|
||||
|
||||
// if (!target && state[i].children) {
|
||||
@ -24,7 +28,7 @@ export const getCurrentById = (targetId) => {
|
||||
}
|
||||
};
|
||||
|
||||
findById(navigation, targetId);
|
||||
findById(navigation, id);
|
||||
|
||||
return { target, activeIds };
|
||||
};
|
||||
|
@ -167,7 +167,7 @@ export default class ApplicationPage extends React.Component {
|
||||
if (!page || !page.id) {
|
||||
page = { id: "NAV_DATA", scrollTop: 0, data: null };
|
||||
}
|
||||
const current = NavigationData.getCurrentById(page.id);
|
||||
const current = NavigationData.getCurrent(page);
|
||||
|
||||
let slate = null;
|
||||
if (
|
||||
@ -303,7 +303,7 @@ export default class ApplicationPage extends React.Component {
|
||||
if (!page || !page.id) {
|
||||
page = { id: "NAV_DATA", scrollTop: 0, data: null };
|
||||
}
|
||||
const current = NavigationData.getCurrentById(page.id);
|
||||
const current = NavigationData.getCurrent(page);
|
||||
|
||||
let slate = null;
|
||||
if (
|
||||
@ -372,6 +372,7 @@ export default class ApplicationPage extends React.Component {
|
||||
return res.status === "fulfilled" && res.value && !res.value.error;
|
||||
})
|
||||
.map((res) => res.value);
|
||||
|
||||
if (slate && slate.id) {
|
||||
await FileUtilities.uploadToSlate({ responses: succeeded, slate });
|
||||
}
|
||||
@ -644,7 +645,7 @@ export default class ApplicationPage extends React.Component {
|
||||
if (!page || !page.id) {
|
||||
page = { id: "NAV_DATA", scrollTop: 0, data: null };
|
||||
}
|
||||
const current = NavigationData.getCurrentById(page.id);
|
||||
const current = NavigationData.getCurrent(page);
|
||||
|
||||
// NOTE(jim): Only happens during a bad query parameter.
|
||||
if (!current.target) {
|
||||
|
Loading…
Reference in New Issue
Block a user