Skip to content

Commit

Permalink
chore(web): fix value input asset datatype (#698)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyshx authored Sep 20, 2023
1 parent 70d1dde commit bb362bb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion web/src/beta/features/Editor/DataSourceManager/Asset/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ const Asset: React.FC<DataProps> = ({ sceneId, onSubmit, onClose }) => {
);

const handleSubmit = () => {
let parsedValue = null;

if (sourceType === "value" && value !== "") {
try {
parsedValue = JSON.parse(value);
} catch (error) {
parsedValue = value;
}
}
onSubmit({
layerType: "simple",
sceneId,
Expand All @@ -59,7 +68,7 @@ const Asset: React.FC<DataProps> = ({ sceneId, onSubmit, onClose }) => {
data: {
url: sourceType === "url" && value !== "" ? value : null,
type: fileFormat.toLowerCase(),
value: sourceType === "value" && value !== "" ? value : null,
value: parsedValue,
},
resource: {
clampToGround: true,
Expand Down

0 comments on commit bb362bb

Please sign in to comment.