mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-09 20:28:29 +03:00
added resource URI
This commit is contained in:
parent
95ce91e05b
commit
2f84dfafa8
@ -122,11 +122,11 @@ export const createSubscription = async (data) => {
|
||||
};
|
||||
|
||||
export const search = async (data) => {
|
||||
if (Strings.isEmpty(data.query)) {
|
||||
if (Strings.isEmpty(data.query) || Strings.isEmpty(data.resourceURI)) {
|
||||
return { decorator: "NO_SERVER_TRIP", data: { results: [] } };
|
||||
}
|
||||
|
||||
return await returnJSON(`http://localhost:1313/search`, {
|
||||
return await returnJSON(`${data.resourceURI}/search`, {
|
||||
...CORS_OPTIONS,
|
||||
body: JSON.stringify({ data }),
|
||||
});
|
||||
|
@ -984,6 +984,7 @@ export default class ApplicationPage extends React.Component {
|
||||
viewer={this.state.viewer}
|
||||
onAction={this._handleAction}
|
||||
mobile={this.props.mobile}
|
||||
resourceURI={this.props.resources.search}
|
||||
/>
|
||||
</WebsitePrototypeWrapper>
|
||||
</React.Fragment>
|
||||
|
@ -2,6 +2,7 @@ import * as React from "react";
|
||||
import * as Constants from "~/common/constants";
|
||||
import * as SVG from "~/common/svg";
|
||||
import * as Actions from "~/common/actions";
|
||||
import * as Strings from "~/common/strings";
|
||||
import * as Window from "~/common/window";
|
||||
import * as Validations from "~/common/validations";
|
||||
|
||||
@ -111,46 +112,6 @@ const STYLES_PROFILE_IMAGE = css`
|
||||
`;
|
||||
|
||||
const UserPreview = ({ item, viewer }) => {
|
||||
let followStatus = "Not following";
|
||||
let trustStatus = "Not trusted";
|
||||
let trust = viewer.trusted.filter((entry) => {
|
||||
return entry.target_user_id === item.id;
|
||||
});
|
||||
if (trust.length) {
|
||||
if (trust[0].data.verified) {
|
||||
trustStatus = "Trusted";
|
||||
} else {
|
||||
trustStatus = "Trust request sent";
|
||||
}
|
||||
}
|
||||
let pendingTrust = viewer.pendingTrusted.filter((entry) => {
|
||||
return entry.owner_user_id === item.id;
|
||||
});
|
||||
if (pendingTrust.length) {
|
||||
if (pendingTrust[0].data.verified) {
|
||||
trustStatus = "Trusted";
|
||||
} else {
|
||||
trustStatus = "Requested to trust you";
|
||||
}
|
||||
}
|
||||
if (
|
||||
viewer.subscriptions.filter((entry) => {
|
||||
return entry.target_user_id === item.id;
|
||||
}).length
|
||||
) {
|
||||
followStatus = "Following";
|
||||
}
|
||||
if (
|
||||
viewer.subscribers.filter((entry) => {
|
||||
return entry.owner_user_id === item.id;
|
||||
}).length
|
||||
) {
|
||||
if (followStatus === "Following") {
|
||||
followStatus = "You follow each other";
|
||||
} else {
|
||||
followStatus = "Follows you";
|
||||
}
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<div css={STYLES_PROFILE_IMAGE} style={{ backgroundImage: `url('${item.data.photo}')` }} />
|
||||
@ -161,10 +122,6 @@ const UserPreview = ({ item, viewer }) => {
|
||||
{item.data.slates.length} Slate{item.data.slates.length === 1 ? "" : "s"}
|
||||
</div>
|
||||
) : null}
|
||||
{followStatus === "Not following" ? null : (
|
||||
<div css={STYLES_PREVIEW_TEXT}>{followStatus}</div>
|
||||
)}
|
||||
{trustStatus === "Not trusted" ? null : <div css={STYLES_PREVIEW_TEXT}>{trustStatus}</div>}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@ -849,6 +806,7 @@ export class SearchModal extends React.Component {
|
||||
let res;
|
||||
if (!refilter) {
|
||||
let response = await Actions.search({
|
||||
resourceURI: this.props.resourceURI,
|
||||
query: this.state.inputValue,
|
||||
type: this.state.typeFilter,
|
||||
userId: this.props.viewer.id,
|
||||
|
@ -47,6 +47,7 @@ const EXTERNAL_RESOURCES = {
|
||||
? null
|
||||
: Environment.RESOURCE_URI_STORAGE_UPLOAD,
|
||||
pubsub: Strings.isEmpty(Environment.RESOURCE_URI_PUBSUB) ? null : Environment.RESOURCE_URI_PUBSUB,
|
||||
search: Strings.isEmpty(Environment.RESOURCE_URI_SEARCH) ? null : Environment.RESOURCE_URI_SEARCH,
|
||||
};
|
||||
|
||||
app.prepare().then(async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user