Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F1263059
resource.jsx
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
860 B
Referenced Files
None
Subscribers
None
resource.jsx
View Options
const
React
=
require
(
"react"
);
const
CachedHttp
=
require
(
"./cached-http.js"
);
module
.
exports
=
(
{
collection
,
get_forced_filter
=
()
=>
{},
get_forced_format
=
()
=>
{}
},
component
)
=>
class
Resource
extends
React
.
Component
{
constructor
()
{
super
();
this
.
state
=
{
loading
:
true
,
resource
:
null
,
};
}
componentDidMount
()
{
CachedHttp
.
get
(
`/api/v1/collections/
${
collection
}
/
${
this
.
props
.
id
}
`
,
{
filter
:
Object
.
assign
({},
get_forced_filter
(
this
.
props
)),
format
:
get_forced_format
(
this
.
props
),
}
).
then
(
resource
=>
this
.
setState
({
loading
:
false
,
resource
}));
}
render
()
{
if
(
!
this
.
props
.
id
)
{
throw
Error
(
"Please provide the resource id as an 'id' prop"
);
}
return
React
.
createElement
(
component
,
{
resource
:
this
.
state
.
resource
,
loading
:
this
.
state
.
loading
,
});
}
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 24, 16:03 (14 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
601632
Default Alt Text
resource.jsx (860 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment