mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 13:51:13 +00:00
Handle CrossPostParams when mounting CreatePost (#2521)
This commit is contained in:
parent
761cd7aa4e
commit
661a8000cd
1 changed files with 15 additions and 8 deletions
|
@ -194,6 +194,18 @@ export class CreatePost extends Component<
|
||||||
loading: false,
|
loading: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const locationState = this.props.history.location.state as
|
||||||
|
| CrossPostParams
|
||||||
|
| undefined;
|
||||||
|
if (locationState) {
|
||||||
|
this.updateUrl({
|
||||||
|
title: locationState.name,
|
||||||
|
url: locationState.url,
|
||||||
|
body: locationState.body,
|
||||||
|
});
|
||||||
|
this.setState(s => ({ resetCounter: s.resetCounter + 1 }));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,15 +236,10 @@ export class CreatePost extends Component<
|
||||||
url,
|
url,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
// Only use the name, url, and body from this
|
|
||||||
const locationState = this.props.history.location.state as
|
|
||||||
| CrossPostParams
|
|
||||||
| undefined;
|
|
||||||
|
|
||||||
const params: PostFormParams = {
|
const params: PostFormParams = {
|
||||||
name: title || locationState?.name,
|
name: title,
|
||||||
url: url || locationState?.url,
|
url,
|
||||||
body: body || locationState?.body,
|
body,
|
||||||
community_id: communityId,
|
community_id: communityId,
|
||||||
custom_thumbnail: customThumbnailUrl,
|
custom_thumbnail: customThumbnailUrl,
|
||||||
language_id: languageId,
|
language_id: languageId,
|
||||||
|
|
Loading…
Reference in a new issue