mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
ycore.ng_comty & rs_cloud => API_CALL
This commit is contained in:
parent
1c284e0070
commit
cc00d36f14
@ -1,8 +1,8 @@
|
|||||||
// List of modules uploaded to yCore
|
// List of modules used for this app
|
||||||
export * from './libs/comty_ng/pre.js';
|
export * from './libs/comty_ng/pre.js';
|
||||||
export * from './libs/yulio_id/pre.js';
|
export * from './libs/yulio_id/pre.js';
|
||||||
export * from './libs/ycore_styles/pre.js';
|
export * from './libs/ycore_styles/pre.js';
|
||||||
export * from './libs/ycore_sdcp/pre.js';
|
export * from './libs/ycore_sdcp/pre.js';
|
||||||
export * from './libs/app_functions/pre.js'
|
export * from './libs/app_functions/pre.js'
|
||||||
|
export * from './libs/rs_cloud/pre.js'
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import * as ycore from 'ycore'
|
import * as ycore from 'ycore'
|
||||||
var jquery = require("jquery");
|
|
||||||
import * as Icons from '@ant-design/icons'
|
import * as Icons from '@ant-design/icons'
|
||||||
import { RenderFeed } from 'components/MainFeed'
|
import { RenderFeed } from 'components/MainFeed'
|
||||||
|
|
||||||
|
|
||||||
export const FeedHandler = {
|
export const FeedHandler = {
|
||||||
refresh: () => {
|
refresh: () => {
|
||||||
RenderFeed.RefreshFeed()
|
RenderFeed.RefreshFeed()
|
||||||
@ -34,310 +32,103 @@ export const IsThisPost = {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Post_Comments = {
|
export const Post_Comments = {
|
||||||
delete: (callback, payload) => {
|
delete: (callback, payload) => {
|
||||||
if (!payload) {
|
if (!payload) {return false}
|
||||||
return false
|
|
||||||
}
|
|
||||||
const { comment_id } = payload
|
const { comment_id } = payload
|
||||||
|
|
||||||
let formdata = new FormData();
|
let formdata = new FormData();
|
||||||
formdata.append("type", "delete");
|
formdata.append("type", "delete");
|
||||||
formdata.append("comment_id", comment_id);
|
formdata.append("comment_id", comment_id);
|
||||||
|
|
||||||
API_Call((err,res)=> {
|
ycore.API_Call((err,res)=> {
|
||||||
return callback(err,res)
|
return callback(err,res)
|
||||||
},
|
},
|
||||||
ycore.endpoints.comments_actions,
|
ycore.endpoints.comments_actions,
|
||||||
formdata,
|
formdata,
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function API_Call(callback, endpoint, payload, options){
|
|
||||||
if (!payload || !endpoint) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
let payloadContainer = payload;
|
|
||||||
payloadContainer.append("server_key", ycore.yConfig.server_key);
|
|
||||||
const defaultOptions = { method: "POST", timeout: 0, processData: false }
|
|
||||||
const { method, timeout, processData } = options || defaultOptions
|
|
||||||
|
|
||||||
const requestOptions = {
|
|
||||||
"url": `${endpoint}${ycore.handlerYIDT.__token()}`,
|
|
||||||
"method": method,
|
|
||||||
"timeout": timeout,
|
|
||||||
"data": payloadContainer,
|
|
||||||
"mimeType": "multipart/form-data",
|
|
||||||
"processData": processData,
|
|
||||||
"contentType": false
|
|
||||||
};
|
|
||||||
|
|
||||||
jquery.ajax(requestOptions)
|
|
||||||
.done(response => {
|
|
||||||
ycore.yconsole.log(response)
|
|
||||||
return callback(false, response)
|
|
||||||
})
|
|
||||||
.fail(error => {
|
|
||||||
ycore.yconsole.log('error', error)
|
|
||||||
ycore.Alive_API.fail(error)
|
|
||||||
return callback(true, error)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
export function GetGeneralData(callback){
|
|
||||||
let formdata = new FormData();
|
|
||||||
formdata.append("user_id", id);
|
|
||||||
formdata.append("server_key", ycore.yConfig.server_key);
|
|
||||||
const requestOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
body: formdata,
|
|
||||||
redirect: 'follow'
|
|
||||||
};
|
|
||||||
const urlObj = `${ycore.endpoints.get_general_data}${ycore.handlerYIDT.__token()}`
|
|
||||||
fetch(urlObj, requestOptions)
|
|
||||||
.then(response => {
|
|
||||||
ycore.yconsole.log(response)
|
|
||||||
return callback(false, response)
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.log('error', error)
|
|
||||||
ycore.Alive_API.fail(error)
|
|
||||||
return callback(true, error)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function follow_user(id, callback) {
|
|
||||||
let formdata = new FormData();
|
|
||||||
formdata.append("user_id", id);
|
|
||||||
formdata.append("server_key", ycore.yConfig.server_key);
|
|
||||||
const requestOptions = {
|
|
||||||
method: 'POST',
|
|
||||||
body: formdata,
|
|
||||||
redirect: 'follow'
|
|
||||||
};
|
|
||||||
ycore.yconsole.log(`Following user => ${id} `)
|
|
||||||
const urlObj = `${ycore.endpoints.follow_user}${ycore.handlerYIDT.__token()}`
|
|
||||||
fetch(urlObj, requestOptions)
|
|
||||||
.then(response => {
|
|
||||||
ycore.yconsole.log(response)
|
|
||||||
return callback(false, response)
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
ycore.Alive_API.fail(error)
|
|
||||||
console.log('error', error)
|
|
||||||
return callback(true, error)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export const GetPostPrivacy = {
|
|
||||||
bool: (e) => {
|
|
||||||
switch (e) {
|
|
||||||
case 'any':
|
|
||||||
return '0'
|
|
||||||
case 'only_followers':
|
|
||||||
return '1'
|
|
||||||
case 'only_follow':
|
|
||||||
return '2'
|
|
||||||
case 'private':
|
|
||||||
return '3'
|
|
||||||
default:
|
|
||||||
return '0'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
decorator: (e) => {
|
new: (callback, payload) => {
|
||||||
switch (e) {
|
if (!payload) {
|
||||||
case 'any':
|
|
||||||
return <span><Icons.GlobalOutlined /> Share with everyone</span>
|
|
||||||
case 'only_follow':
|
|
||||||
return <span><Icons.TeamOutlined /> Share with people I follow</span>
|
|
||||||
case 'only_followers':
|
|
||||||
return <span><Icons.UsergroupAddOutlined /> Share with people follow me</span>
|
|
||||||
case 'private':
|
|
||||||
return <span><Icons.EyeInvisibleOutlined /> Dont share, only me</span>
|
|
||||||
default:
|
|
||||||
return <span>Unknown</span>
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export function PublishPost(privacy, raw, file, callback){
|
|
||||||
const rawtext = raw;
|
|
||||||
if(!rawtext){
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
let formdata = new FormData();
|
|
||||||
formdata.append("user_id", ycore.handlerYIDT.__id());
|
|
||||||
formdata.append("type", "new_post")
|
|
||||||
formdata.append("server_key", ycore.yConfig.server_key);
|
|
||||||
formdata.append("postPrivacy", privacy)
|
|
||||||
formdata.append("postText", raw);
|
|
||||||
file? formdata.append("postPhoto", file) : null
|
|
||||||
|
|
||||||
const requestOptions = {
|
|
||||||
"url": `${ycore.endpoints.new_post}${ycore.handlerYIDT.__token()}`,
|
|
||||||
"method": "POST",
|
|
||||||
"timeout": 0,
|
|
||||||
"data": formdata,
|
|
||||||
"mimeType": "multipart/form-data",
|
|
||||||
"processData": false,
|
|
||||||
"contentType": false
|
|
||||||
};
|
|
||||||
|
|
||||||
ycore.yconsole.log(`Sending new post => ${rawtext} `)
|
|
||||||
jquery.ajax(requestOptions)
|
|
||||||
.done(response => {
|
|
||||||
ycore.yconsole.log(response)
|
|
||||||
return callback(false, response)
|
|
||||||
})
|
|
||||||
.fail(error => {
|
|
||||||
ycore.yconsole.log('error', error)
|
|
||||||
ycore.Alive_API.fail(error)
|
|
||||||
return callback(true, error)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function FindUser(key, callback){
|
|
||||||
let formdata = new FormData();
|
|
||||||
formdata.append("server_key", ycore.yConfig.server_key);
|
|
||||||
formdata.append("search_key", key);
|
|
||||||
const urlOBJ = `${ycore.endpoints.find_user}${ycore.handlerYIDT.__token()}`
|
|
||||||
const settings = {
|
|
||||||
"url": urlOBJ,
|
|
||||||
"method": "POST",
|
|
||||||
"timeout": 10000,
|
|
||||||
"processData": false,
|
|
||||||
"mimeType": "multipart/form-data",
|
|
||||||
"contentType": false,
|
|
||||||
"data": formdata
|
|
||||||
};
|
|
||||||
jquery.ajax(settings)
|
|
||||||
.done(function (response) {
|
|
||||||
return callback(null, response);
|
|
||||||
})
|
|
||||||
.fail(function (response) {
|
|
||||||
const exception = 'API Bad response';
|
|
||||||
ycore.Alive_API.fail(response)
|
|
||||||
return callback(exception, response);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function SeachKeywords(key, callback){
|
|
||||||
let formdata = new FormData();
|
|
||||||
formdata.append("server_key", ycore.yConfig.server_key);
|
|
||||||
formdata.append("search_key", key);
|
|
||||||
const urlOBJ = `${ycore.endpoints.search_endpoint}${ycore.handlerYIDT.__token()}`
|
|
||||||
const settings = {
|
|
||||||
"url": urlOBJ,
|
|
||||||
"method": "POST",
|
|
||||||
"timeout": 10000,
|
|
||||||
"processData": false,
|
|
||||||
"mimeType": "multipart/form-data",
|
|
||||||
"contentType": false,
|
|
||||||
"data": formdata
|
|
||||||
};
|
|
||||||
jquery.ajax(settings)
|
|
||||||
.done(function (response) {
|
|
||||||
return callback(null, response);
|
|
||||||
})
|
|
||||||
.fail(function (response) {
|
|
||||||
const exception = 'Request Failed';
|
|
||||||
ycore.Alive_API.fail(response)
|
|
||||||
return callback(exception, response);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
export function ActionPost(type, id, value, callback){
|
|
||||||
if (!type || !id) {
|
|
||||||
ycore.notifyError('[ActionPost] No type or id Provided !!!')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
var formdata = new FormData();
|
|
||||||
formdata.append("server_key", ycore.yConfig.server_key);
|
|
||||||
formdata.append("post_id", id);
|
|
||||||
switch (type) {
|
|
||||||
case 'like':
|
|
||||||
{
|
|
||||||
formdata.append("action", "like");
|
|
||||||
break
|
|
||||||
}
|
|
||||||
case 'comment':
|
|
||||||
{
|
|
||||||
if (!value) {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
const { post_id, raw_text } = payload
|
||||||
|
|
||||||
|
let formdata = new FormData();
|
||||||
formdata.append("action", "comment");
|
formdata.append("action", "comment");
|
||||||
formdata.append("text", value)
|
formdata.append("post_id", post_id);
|
||||||
break
|
formdata.append("text", raw_text)
|
||||||
|
|
||||||
|
ycore.API_Call((err,res)=> {
|
||||||
|
return callback(err,res)
|
||||||
|
},
|
||||||
|
ycore.endpoints.action_post,
|
||||||
|
formdata,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
case 'edit':
|
|
||||||
{
|
|
||||||
if (!value) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
formdata.append("action", "edit");
|
|
||||||
formdata.append("text", value)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
case 'delete':
|
|
||||||
{
|
|
||||||
formdata.append("action", "delete");
|
|
||||||
break
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const urlOBJ = `${ycore.endpoints.action_post}${ycore.handlerYIDT.__token()}`
|
export const comty_user = {
|
||||||
const settings = {
|
setData: () => {
|
||||||
"url": urlOBJ,
|
|
||||||
"method": "POST",
|
},
|
||||||
"timeout": 3000,
|
follow: (callback, payload) => {
|
||||||
"processData": false,
|
if (!payload) {return false}
|
||||||
"mimeType": "multipart/form-data",
|
const { user_id } = payload
|
||||||
"contentType": false,
|
|
||||||
"data": formdata
|
let formdata = new FormData();
|
||||||
};
|
formdata.append("user_id", user_id);
|
||||||
jquery.ajax(settings)
|
|
||||||
.done(function (response) {
|
ycore.API_Call((err,res)=> {
|
||||||
return callback(null, response);
|
return callback(err,res)
|
||||||
})
|
},
|
||||||
.fail(function (response) {
|
ycore.endpoints.follow_user,
|
||||||
ycore.Alive_API.fail(response)
|
formdata,
|
||||||
return callback(true, `[Server error] We couldnt ${type} this post`);
|
)
|
||||||
})
|
},
|
||||||
}
|
block:(callback, payload) => {
|
||||||
export function GetUserTags(id, callback){
|
// TO DO
|
||||||
if (!id) {
|
return false
|
||||||
return false
|
},
|
||||||
}
|
find: (callback, payload) => {
|
||||||
|
if (!payload) {return false}
|
||||||
|
const { key } = payload
|
||||||
|
|
||||||
|
let formdata = new FormData();
|
||||||
|
formdata.append("search_key", key);
|
||||||
|
|
||||||
|
const callOptions = { timeout: 10000 }
|
||||||
|
ycore.API_Call((err,res)=> {
|
||||||
|
return callback(err,res)
|
||||||
|
},
|
||||||
|
ycore.endpoints.find_user,
|
||||||
|
formdata,
|
||||||
|
callOptions
|
||||||
|
)
|
||||||
|
},
|
||||||
|
__tags: (callback, payload) => {
|
||||||
|
if (!payload) {return false}
|
||||||
|
const { id } = payload
|
||||||
|
|
||||||
let formdata = new FormData();
|
let formdata = new FormData();
|
||||||
formdata.append("server_key", ycore.yConfig.server_key);
|
|
||||||
formdata.append("user_id", id )
|
formdata.append("user_id", id )
|
||||||
|
|
||||||
const urlOBJ = `${ycore.endpoints.get_user_tags}${ycore.handlerYIDT.__token()}`
|
ycore.API_Call((err,res)=> {
|
||||||
const settings = {
|
return callback(err,res)
|
||||||
"url": urlOBJ,
|
},
|
||||||
"method": "POST",
|
ycore.endpoints.get_user_tags,
|
||||||
"timeout": 0,
|
formdata
|
||||||
"processData": false,
|
)
|
||||||
"mimeType": "multipart/form-data",
|
|
||||||
"contentType": false,
|
|
||||||
"data": formdata
|
|
||||||
};
|
|
||||||
jquery.ajax(settings)
|
|
||||||
.done(function (response) {
|
|
||||||
return callback(null, response);
|
|
||||||
})
|
|
||||||
.fail(function (response) {
|
|
||||||
const exception = 'Request Failed';
|
|
||||||
ycore.Alive_API.fail(response)
|
|
||||||
return callback(exception, response);
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
export function GetPosts(userid, type, fkey, callback) {
|
}
|
||||||
|
|
||||||
|
export const comty_post = {
|
||||||
|
getFeed: (callback, payload) => {
|
||||||
|
if (!payload) {return false}
|
||||||
|
const { fkey, type, id } = payload
|
||||||
|
|
||||||
let formdata = new FormData();
|
let formdata = new FormData();
|
||||||
formdata.append("server_key", ycore.yConfig.server_key);
|
|
||||||
formdata.append("after_post_id", (fkey || 0))
|
formdata.append("after_post_id", (fkey || 0))
|
||||||
formdata.append("limit", ycore.AppSettings.limit_post_catch || 20)
|
formdata.append("limit", ycore.AppSettings.limit_post_catch || 20)
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -346,61 +137,121 @@ export function GetPosts(userid, type, fkey, callback) {
|
|||||||
break;
|
break;
|
||||||
case 'user':
|
case 'user':
|
||||||
formdata.append("type", "get_user_posts");
|
formdata.append("type", "get_user_posts");
|
||||||
formdata.append("id", userid)
|
formdata.append("id", id)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
formdata.append("type", "get_news_feed");
|
formdata.append("type", "get_news_feed");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const urlOBJ = `${ycore.endpoints.get_posts}${ycore.handlerYIDT.__token()}`
|
ycore.API_Call((err,res)=> {
|
||||||
const settings = {
|
return callback(err,res)
|
||||||
"url": urlOBJ,
|
},
|
||||||
"method": "POST",
|
ycore.endpoints.get_posts,
|
||||||
"timeout": 10000,
|
formdata,
|
||||||
"processData": false,
|
)
|
||||||
"mimeType": "multipart/form-data",
|
|
||||||
"contentType": false,
|
|
||||||
"data": formdata
|
|
||||||
};
|
|
||||||
jquery.ajax(settings)
|
|
||||||
.done(function (response) {
|
|
||||||
return callback(null, response);
|
|
||||||
})
|
|
||||||
.fail(function (response) {
|
|
||||||
const exception = 'Request Failed';
|
|
||||||
ycore.Alive_API.fail(response)
|
|
||||||
return callback(exception, response);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
export function GetPostData(a, b, callback){
|
|
||||||
if(!a){
|
|
||||||
ycore.notifyError('Is required to provide an post id!!!')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
let formdata = new FormData();
|
|
||||||
formdata.append("server_key", ycore.yConfig.server_key);
|
|
||||||
formdata.append("post_id", a)
|
|
||||||
formdata.append("fetch", (b || "post_data,post_comments,post_wondered_users,post_liked_users"))
|
|
||||||
|
|
||||||
const urlOBJ = `${ycore.endpoints.get_post_data}${ycore.handlerYIDT.__token()}`
|
},
|
||||||
const settings = {
|
get: (callback, payload) => {
|
||||||
"url": urlOBJ,
|
if (!payload) {return false}
|
||||||
"method": "POST",
|
const { post_id, fetch } = payload
|
||||||
"timeout": 10000,
|
|
||||||
"processData": false,
|
let formdata = new FormData();
|
||||||
"mimeType": "multipart/form-data",
|
formdata.append("post_id", post_id)
|
||||||
"contentType": false,
|
formdata.append("fetch", (fetch || "post_data,post_comments,post_wondered_users,post_liked_users"))
|
||||||
"data": formdata
|
|
||||||
};
|
ycore.API_Call((err,res)=> {
|
||||||
jquery.ajax(settings)
|
return callback(err,res)
|
||||||
.done(function (response) {
|
},
|
||||||
return callback(null, response);
|
ycore.endpoints.get_post_data,
|
||||||
})
|
formdata
|
||||||
.fail(function (response) {
|
)
|
||||||
const exception = 'Request Failed';
|
|
||||||
ycore.Alive_API.fail(response)
|
},
|
||||||
return callback(exception, response);
|
new: (callback, payload) => {
|
||||||
})
|
if (!payload) {return false}
|
||||||
|
const { privacy, text, file } = payload
|
||||||
|
|
||||||
|
let formdata = new FormData();
|
||||||
|
formdata.append("type", "new_post")
|
||||||
|
formdata.append("postPrivacy", privacy)
|
||||||
|
formdata.append("postText", text);
|
||||||
|
file? formdata.append("postPhoto", file) : null
|
||||||
|
|
||||||
|
const callOptions = { includeUserID: true }
|
||||||
|
ycore.API_Call((err,res)=> {
|
||||||
|
return callback(err,res)
|
||||||
|
},
|
||||||
|
ycore.endpoints.new_post,
|
||||||
|
formdata,
|
||||||
|
callOptions
|
||||||
|
)
|
||||||
|
},
|
||||||
|
delete: (callback, payload) => {
|
||||||
|
if (!payload) {return false}
|
||||||
|
const { post_id } = payload
|
||||||
|
|
||||||
|
let formdata = new FormData();
|
||||||
|
formdata.append("action", "delete");
|
||||||
|
formdata.append("post_id", post_id)
|
||||||
|
|
||||||
|
ycore.API_Call((err,res)=> {
|
||||||
|
return callback(err,res)
|
||||||
|
},
|
||||||
|
ycore.endpoints.action_post,
|
||||||
|
formdata,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
save: (callback, payload) => {
|
||||||
|
|
||||||
|
},
|
||||||
|
edit: (callback, payload) =>{
|
||||||
|
|
||||||
|
},
|
||||||
|
__pin: (callback, payload) => {
|
||||||
|
|
||||||
|
},
|
||||||
|
__boost: (callback, payload) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const comty_search = {
|
||||||
|
keywords: (callback, payload) =>{
|
||||||
|
if (!payload) {return false}
|
||||||
|
const { key } = payload
|
||||||
|
|
||||||
|
let formdata = new FormData();
|
||||||
|
formdata.append("search_key", key);
|
||||||
|
|
||||||
|
const callOptions = { timeout: 10000 }
|
||||||
|
ycore.API_Call((err,res)=> {
|
||||||
|
return callback(err,res)
|
||||||
|
},
|
||||||
|
ycore.endpoints.search_endpoint,
|
||||||
|
formdata,
|
||||||
|
callOptions
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const comty_get = {
|
||||||
|
session_data: () => {
|
||||||
|
|
||||||
|
},
|
||||||
|
general_data: () => {
|
||||||
|
if (!payload) {return false}
|
||||||
|
const { id } = payload
|
||||||
|
|
||||||
|
let formdata = new FormData();
|
||||||
|
formdata.append("user_id", id);
|
||||||
|
|
||||||
|
ycore.API_Call((err,res)=> {
|
||||||
|
return callback(err,res)
|
||||||
|
},
|
||||||
|
ycore.endpoints.get_general_data,
|
||||||
|
formdata
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const get_app_session = {
|
export const get_app_session = {
|
||||||
@ -447,3 +298,36 @@ export const get_app_session = {
|
|||||||
.catch(error => ycore.yconsole.log('error', error));
|
.catch(error => ycore.yconsole.log('error', error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const GetPostPrivacy = {
|
||||||
|
bool: (e) => {
|
||||||
|
switch (e) {
|
||||||
|
case 'any':
|
||||||
|
return '0'
|
||||||
|
case 'only_followers':
|
||||||
|
return '1'
|
||||||
|
case 'only_follow':
|
||||||
|
return '2'
|
||||||
|
case 'private':
|
||||||
|
return '3'
|
||||||
|
default:
|
||||||
|
return '0'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
decorator: (e) => {
|
||||||
|
switch (e) {
|
||||||
|
case 'any':
|
||||||
|
return <span><Icons.GlobalOutlined /> Share with everyone</span>
|
||||||
|
case 'only_follow':
|
||||||
|
return <span><Icons.TeamOutlined /> Share with people I follow</span>
|
||||||
|
case 'only_followers':
|
||||||
|
return <span><Icons.UsergroupAddOutlined /> Share with people follow me</span>
|
||||||
|
case 'private':
|
||||||
|
return <span><Icons.EyeInvisibleOutlined /> Dont share, only me</span>
|
||||||
|
default:
|
||||||
|
return <span>Unknown</span>
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
62
src/@ycore/libs/rs_cloud/pre.js
Normal file
62
src/@ycore/libs/rs_cloud/pre.js
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import jquery from 'jquery'
|
||||||
|
import * as ycore from 'ycore'
|
||||||
|
import { FormatColorResetOutlined } from '@material-ui/icons'
|
||||||
|
|
||||||
|
export const Alive_API = {
|
||||||
|
fail: (a) => {
|
||||||
|
if (a){
|
||||||
|
ycore.yconsole.log(a)
|
||||||
|
ycore.notify.error(a)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function API_Call(callback, endpoint, payload, options){
|
||||||
|
if (!payload || !endpoint) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
let payloadContainer = payload;
|
||||||
|
payloadContainer.append("server_key", ycore.yConfig.server_key);
|
||||||
|
|
||||||
|
let method;
|
||||||
|
let timeout;
|
||||||
|
let processData;
|
||||||
|
let includeUserID;
|
||||||
|
|
||||||
|
if (options) {
|
||||||
|
method = options.method? options.method : "POST"
|
||||||
|
timeout = options.timeout? options.timeout : 0
|
||||||
|
processData = options.processData? options.processData : false
|
||||||
|
includeUserID = options.includeUserID? options.includeUserID : false
|
||||||
|
}else {
|
||||||
|
method = "POST"
|
||||||
|
timeout = 0
|
||||||
|
processData = false
|
||||||
|
includeUserID = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (includeUserID) {
|
||||||
|
payloadContainer.append("user_id", ycore.handlerYIDT.__id());
|
||||||
|
}
|
||||||
|
|
||||||
|
const requestOptions = {
|
||||||
|
"url": `${endpoint}${ycore.handlerYIDT.__token()}`,
|
||||||
|
"method": method,
|
||||||
|
"timeout": timeout,
|
||||||
|
"data": payloadContainer,
|
||||||
|
"mimeType": "multipart/form-data",
|
||||||
|
"processData": processData,
|
||||||
|
"contentType": false
|
||||||
|
};
|
||||||
|
|
||||||
|
jquery.ajax(requestOptions)
|
||||||
|
.done(response => {
|
||||||
|
ycore.yconsole.log(response)
|
||||||
|
return callback(false, response)
|
||||||
|
})
|
||||||
|
.fail(error => {
|
||||||
|
ycore.yconsole.log('error', error)
|
||||||
|
ycore.Alive_API.fail(error)
|
||||||
|
return callback(true, error)
|
||||||
|
});
|
||||||
|
}
|
@ -11,14 +11,7 @@ var jwt = require("jsonwebtoken")
|
|||||||
export function userData(){
|
export function userData(){
|
||||||
return ycore.handlerYIDT.get()
|
return ycore.handlerYIDT.get()
|
||||||
}
|
}
|
||||||
export const Alive_API = {
|
|
||||||
fail: (a) => {
|
|
||||||
if (a){
|
|
||||||
ycore.yconsole.log(a)
|
|
||||||
ycore.notify.error(a)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function __API__User (payload, sdcp, callback){
|
function __API__User (payload, sdcp, callback){
|
||||||
const { UserID, UserToken } = payload
|
const { UserID, UserToken } = payload
|
||||||
|
@ -16,6 +16,7 @@ import React from "react";
|
|||||||
|
|
||||||
import config from "config"
|
import config from "config"
|
||||||
import "./libs.js"
|
import "./libs.js"
|
||||||
|
import { func } from "prop-types";
|
||||||
|
|
||||||
export * from "../../config/app.settings.js"
|
export * from "../../config/app.settings.js"
|
||||||
export * from "./libs.js"
|
export * from "./libs.js"
|
||||||
@ -66,6 +67,36 @@ export function b64toBlob(b64Data, contentType, sliceSize) {
|
|||||||
var blob = new Blob(byteArrays, {type: contentType});
|
var blob = new Blob(byteArrays, {type: contentType});
|
||||||
return blob;
|
return blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ReadFileAsB64(file, callback){
|
||||||
|
if (file) {
|
||||||
|
var reader = new FileReader();
|
||||||
|
|
||||||
|
reader.onload = function(readerEvt) {
|
||||||
|
var binaryString = readerEvt.target.result;
|
||||||
|
const a = `data:image/png;base64, ${btoa(binaryString)}`
|
||||||
|
return callback(a)
|
||||||
|
};
|
||||||
|
|
||||||
|
reader.readAsBinaryString(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function uploadFile(file) {
|
||||||
|
var formData = new FormData();
|
||||||
|
formData.append("userfile", file);
|
||||||
|
var request = new XMLHttpRequest();
|
||||||
|
request.onload = function () {
|
||||||
|
if (request.status == 200) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
alert('Error! Upload failed');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
request.open("POST", "/temp/file");
|
||||||
|
request.send(formData);
|
||||||
|
}
|
||||||
|
|
||||||
export const time = {
|
export const time = {
|
||||||
ago: (a) => {
|
ago: (a) => {
|
||||||
const format = moment(a).format('DDMMYYYY');
|
const format = moment(a).format('DDMMYYYY');
|
||||||
@ -296,3 +327,4 @@ export const yconsole = {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,22 @@ export class __secComments extends React.Component {
|
|||||||
console.log(`Removing Comment with id => ${id}`)
|
console.log(`Removing Comment with id => ${id}`)
|
||||||
ycore.Post_Comments.delete((err, res) => { if(err){return false} return this.reloadComments() }, {comment_id: id})
|
ycore.Post_Comments.delete((err, res) => { if(err){return false} return this.reloadComments() }, {comment_id: id})
|
||||||
}
|
}
|
||||||
|
handleNewComment(){
|
||||||
|
const { raw_comment } = this.state
|
||||||
|
const { post_id } = this.props
|
||||||
|
if (raw_comment) {
|
||||||
|
const payload = { post_id: post_id, raw_text: raw_comment }
|
||||||
|
ycore.Post_Comments.new((err,res) =>{
|
||||||
|
if (err) {
|
||||||
|
ycore.notify.error('This action could not be performed.', err)
|
||||||
|
}
|
||||||
|
this.setState({ raw_comment: '' })
|
||||||
|
return this.reloadComments()
|
||||||
|
}, payload)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
renderComment = (a) => {
|
renderComment = (a) => {
|
||||||
const {id, time, Orginaltext, publisher} = a
|
const {id, time, Orginaltext, publisher} = a
|
||||||
const CommentMenu = (
|
const CommentMenu = (
|
||||||
@ -95,29 +111,17 @@ export class __secComments extends React.Component {
|
|||||||
reloadComments(){
|
reloadComments(){
|
||||||
try {
|
try {
|
||||||
this.setState({ loading: true })
|
this.setState({ loading: true })
|
||||||
ycore.GetPostData(this.props.post_id, null, (err, res) =>{
|
const payload = { post_id: this.props.post_id }
|
||||||
|
ycore.comty_post.get((err, res) => {
|
||||||
const post_comments = JSON.parse(res)['post_comments']
|
const post_comments = JSON.parse(res)['post_comments']
|
||||||
this.setState({ comment_data: post_comments, loading: false})
|
this.setState({ comment_data: post_comments, loading: false})
|
||||||
})
|
}, payload)
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dispatchNewComment(){
|
|
||||||
const { raw_comment } = this.state
|
|
||||||
const { post_id } = this.props
|
|
||||||
if (raw_comment) {
|
|
||||||
ycore.ActionPost('comment', post_id, raw_comment, (err,res) =>{
|
|
||||||
if (err) {
|
|
||||||
ycore.notify.error('This action could not be performed.', err)
|
|
||||||
}
|
|
||||||
this.setState({ raw_comment: '' })
|
|
||||||
this.reloadComments()
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
@ -141,7 +145,7 @@ export class __secComments extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
<div className={styles.comment_box}>
|
<div className={styles.comment_box}>
|
||||||
<div className={styles.comment_box_body}>
|
<div className={styles.comment_box_body}>
|
||||||
<antd.Input value={this.state.raw_comment} onPressEnter={() => this.dispatchNewComment()} placeholder="Write a comment..." allowClear onChange={this.HandleCommentInput} />
|
<antd.Input value={this.state.raw_comment} onPressEnter={() => this.handleNewComment()} placeholder="Write a comment..." allowClear onChange={this.HandleCommentInput} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -63,20 +63,22 @@ class MainFeed extends React.Component {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.toogleLoader()
|
this.toogleLoader()
|
||||||
ycore.GetPosts(uid, get, '0', (err, result) => {
|
const payload = { fkey: 0, type: get, id: uid }
|
||||||
|
ycore.comty_post.getFeed((err,res) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
ycore.notifyError('Error when get data from this input')
|
ycore.notifyError('Error when get data from this input')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (JSON.parse(result).api_status == '400') {
|
if (JSON.parse(res).api_status == '400') {
|
||||||
this.setState({ invalid: true })
|
this.setState({ invalid: true })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const parsed = JSON.parse(result)['data']
|
const parsed = JSON.parse(res)['data']
|
||||||
|
|
||||||
const isEnd = parsed.length < ycore.AppSettings.limit_post_catch? true : false
|
const isEnd = parsed.length < ycore.AppSettings.limit_post_catch? true : false
|
||||||
this.setState({ isEnd: isEnd, data: parsed, loading: false })
|
this.setState({ isEnd: isEnd, data: parsed, loading: false })
|
||||||
})
|
}, payload)
|
||||||
|
|
||||||
}catch(err){
|
}catch(err){
|
||||||
ycore.notifyError('err')
|
ycore.notifyError('err')
|
||||||
}
|
}
|
||||||
@ -96,7 +98,8 @@ class MainFeed extends React.Component {
|
|||||||
const getLastPost = ycore.objectLast(this.state.data)
|
const getLastPost = ycore.objectLast(this.state.data)
|
||||||
ycore.yconsole.log('LAST POST ID =>', getLastPost.id)
|
ycore.yconsole.log('LAST POST ID =>', getLastPost.id)
|
||||||
|
|
||||||
ycore.GetPosts(uid, get, getLastPost.id, (err, res) => {
|
const payload = { fkey: getLastPost.id, type: get, id: uid }
|
||||||
|
ycore.comty_post.getFeed((err,res) => {
|
||||||
if (err){return false}
|
if (err){return false}
|
||||||
const oldData = this.state.data
|
const oldData = this.state.data
|
||||||
const parsed = JSON.parse(res)['data']
|
const parsed = JSON.parse(res)['data']
|
||||||
@ -104,7 +107,7 @@ class MainFeed extends React.Component {
|
|||||||
const isEnd = parsed.length < ycore.AppSettings.limit_post_catch? true : false
|
const isEnd = parsed.length < ycore.AppSettings.limit_post_catch? true : false
|
||||||
this.setState({ isEnd: isEnd, data: mix, loading: false }, () => ycore.gotoElement(getLastPost.id) )
|
this.setState({ isEnd: isEnd, data: mix, loading: false }, () => ycore.gotoElement(getLastPost.id) )
|
||||||
return true
|
return true
|
||||||
})
|
}, payload)
|
||||||
}catch(err){
|
}catch(err){
|
||||||
ycore.notifyError(err)
|
ycore.notifyError(err)
|
||||||
}
|
}
|
||||||
|
@ -61,11 +61,11 @@ class PostCard extends React.PureComponent{
|
|||||||
|
|
||||||
goToPost(postID){
|
goToPost(postID){
|
||||||
localStorage.setItem('p_back_uid', postID)
|
localStorage.setItem('p_back_uid', postID)
|
||||||
ycore.GetPostData(postID, null, (err, res) => {
|
const payload = {post_id: postID}
|
||||||
console.log(res)
|
ycore.comty_post.get((err,res)=>{
|
||||||
if (err) { return false }
|
if (err) { return false }
|
||||||
ycore.SecondarySwap.openPost(res)
|
ycore.SecondarySwap.openPost(res)
|
||||||
})
|
}, payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
@ -74,13 +74,13 @@ class PostCard extends React.PureComponent{
|
|||||||
const { id, post_time, postText, postFile, publisher, post_likes, is_post_pinned, is_liked, post_comments } = payload || emptyPayload;
|
const { id, post_time, postText, postFile, publisher, post_likes, is_post_pinned, is_liked, post_comments } = payload || emptyPayload;
|
||||||
const handlePostActions = {
|
const handlePostActions = {
|
||||||
delete: (post_id) => {
|
delete: (post_id) => {
|
||||||
ycore.ActionPost('delete', post_id, null, (err, res)=>{
|
const payload = {post_id: post_id}
|
||||||
|
ycore.comty_post.delete((err,res)=> {
|
||||||
if (err) {
|
if (err) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
ycore.yconsole.log(res)
|
|
||||||
ycore.FeedHandler.killByID(post_id)
|
ycore.FeedHandler.killByID(post_id)
|
||||||
})
|
}, payload)
|
||||||
},
|
},
|
||||||
save: () => {
|
save: () => {
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import * as ycore from 'ycore'
|
|||||||
import styles from './index.less'
|
import styles from './index.less'
|
||||||
import * as Icons from '@ant-design/icons';
|
import * as Icons from '@ant-design/icons';
|
||||||
import Icon from '@ant-design/icons'
|
import Icon from '@ant-design/icons'
|
||||||
|
import $ from 'jquery'
|
||||||
import * as MICONS from '@material-ui/icons'
|
import * as MICONS from '@material-ui/icons'
|
||||||
|
|
||||||
import Post_options from './local_components/post_options'
|
import Post_options from './local_components/post_options'
|
||||||
@ -20,6 +21,7 @@ export function HandleVisibility(){
|
|||||||
window.PostCreatorComponent.ToogleVisibility();
|
window.PostCreatorComponent.ToogleVisibility();
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
class PostCreator extends React.PureComponent{
|
class PostCreator extends React.PureComponent{
|
||||||
constructor(props){
|
constructor(props){
|
||||||
super(props),
|
super(props),
|
||||||
@ -74,7 +76,6 @@ class PostCreator extends React.PureComponent{
|
|||||||
ToogleVisibility(){
|
ToogleVisibility(){
|
||||||
this.setState({ visible: !this.state.visible })
|
this.setState({ visible: !this.state.visible })
|
||||||
}
|
}
|
||||||
|
|
||||||
ToogleUpload(){
|
ToogleUpload(){
|
||||||
this.setState({ uploader: !this.state.uploader })
|
this.setState({ uploader: !this.state.uploader })
|
||||||
}
|
}
|
||||||
@ -88,12 +89,9 @@ class PostCreator extends React.PureComponent{
|
|||||||
}
|
}
|
||||||
if (info.file.status === 'done') {
|
if (info.file.status === 'done') {
|
||||||
this.setState({ file: info.file.originFileObj, uploader: false })
|
this.setState({ file: info.file.originFileObj, uploader: false })
|
||||||
getBase64(info.file.originFileObj, fileURL =>
|
getBase64(info.file.originFileObj, fileURL =>{
|
||||||
this.setState({
|
this.setState({fileURL,loading: false})
|
||||||
fileURL,
|
});
|
||||||
loading: false,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -143,14 +141,17 @@ class PostCreator extends React.PureComponent{
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
this.setState({ posting: true, keys_remaining: ycore.AppSettings.MaxLengthPosts })
|
this.setState({ posting: true, keys_remaining: ycore.AppSettings.MaxLengthPosts })
|
||||||
ycore.PublishPost(ycore.GetPostPrivacy.bool(shareWith), rawtext, file, (err, res) => {
|
|
||||||
|
|
||||||
|
const payload = { privacy: ycore.GetPostPrivacy.bool(shareWith), text: rawtext, file: file }
|
||||||
|
ycore.comty_post.new((err,res)=>{
|
||||||
if (err) {
|
if (err) {
|
||||||
ycore.notifyError(err)
|
ycore.notify.error(err)
|
||||||
return
|
return false
|
||||||
}
|
}
|
||||||
this.FlushPostState()
|
this.FlushPostState()
|
||||||
|
},payload)
|
||||||
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
dropRef = React.createRef()
|
dropRef = React.createRef()
|
||||||
|
|
||||||
@ -172,6 +173,27 @@ class PostCreator extends React.PureComponent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const _this = this
|
||||||
|
$("body").bind('paste', function(je){
|
||||||
|
var e = je.originalEvent;
|
||||||
|
for (var i = 0; i < e.clipboardData.items.length; i++) {
|
||||||
|
var item = e.clipboardData.items[i];
|
||||||
|
ycore.yconsole.log('Item: ' + item.type);
|
||||||
|
if (item.type.indexOf('image') != -1) {
|
||||||
|
//item.
|
||||||
|
let a = item.getAsFile()
|
||||||
|
a
|
||||||
|
_this.setState({ file: a })
|
||||||
|
ycore.ReadFileAsB64(a, (res) =>{
|
||||||
|
_this.setState({ fileURL: res })
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// ignore not images
|
||||||
|
ycore.yconsole.log('Discarding not image paste data');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
let div = this.dropRef.current
|
let div = this.dropRef.current
|
||||||
div.addEventListener('dragenter', this.handleDragIn)
|
div.addEventListener('dragenter', this.handleDragIn)
|
||||||
div.addEventListener('dragleave', this.handleDragOut)
|
div.addEventListener('dragleave', this.handleDragOut)
|
||||||
|
@ -23,11 +23,12 @@ class UserProfile extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleFollowUser = () => {
|
handleFollowUser = () => {
|
||||||
ycore.follow_user(this.state.UUID, (exception, response)=>{
|
const payload = { user_id: this.state.UUID }
|
||||||
if(exception){return ycore.notifyError(exception) }
|
ycore.comty_user.follow((err,res)=> {
|
||||||
|
if (err) { return false }
|
||||||
this.setState({Followed: !this.state.Followed})
|
this.setState({Followed: !this.state.Followed})
|
||||||
return
|
return
|
||||||
})
|
}, payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount(){
|
componentDidMount(){
|
||||||
@ -41,10 +42,11 @@ class UserProfile extends React.Component {
|
|||||||
const raw = parsed.toString()
|
const raw = parsed.toString()
|
||||||
const string = raw.replace('/@', "")
|
const string = raw.replace('/@', "")
|
||||||
|
|
||||||
ycore.FindUser(string, (exception, response)=> {
|
const payload = { key: string }
|
||||||
exception? ycore.notifyError(exception) : null
|
ycore.comty_user.find((err,res)=>{
|
||||||
|
err? ycore.notifyError(err) : null
|
||||||
try {
|
try {
|
||||||
const rp = JSON.parse(response)
|
const rp = JSON.parse(res)
|
||||||
ycore.yconsole.log(rp)
|
ycore.yconsole.log(rp)
|
||||||
if (!rp['0']) {
|
if (!rp['0']) {
|
||||||
ycore.yconsole.log('Bad response / User not found')
|
ycore.yconsole.log('Bad response / User not found')
|
||||||
@ -60,17 +62,20 @@ class UserProfile extends React.Component {
|
|||||||
ycore.yconsole.log(`Using aproximate user! => ${c1} / ${c2}`)
|
ycore.yconsole.log(`Using aproximate user! => ${c1} / ${c2}`)
|
||||||
ycore.crouter.native(`@${c1}`)
|
ycore.crouter.native(`@${c1}`)
|
||||||
}
|
}
|
||||||
ycore.GetUserTags(rp['0'].user_id, (err, res) => {
|
|
||||||
|
const payload = { id: rp['0'].user_id }
|
||||||
|
ycore.comty_user.__tags((err,res)=>{
|
||||||
if (err) {
|
if (err) {
|
||||||
ycore.notifyError(err)
|
ycore.notifyError(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
})
|
},payload)
|
||||||
|
|
||||||
this.setState({ UUID: rp['0'].user_id, RenderValue: rp['0'], loading: false , Followed: ycore.booleanFix(rp['0'].is_following)})
|
this.setState({ UUID: rp['0'].user_id, RenderValue: rp['0'], loading: false , Followed: ycore.booleanFix(rp['0'].is_following)})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ycore.notifyError(err)
|
ycore.notifyError(err)
|
||||||
}
|
}
|
||||||
})
|
},payload)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,10 +16,12 @@ export default class Indexer_Post extends React.Component{
|
|||||||
}
|
}
|
||||||
|
|
||||||
toSwap(id){
|
toSwap(id){
|
||||||
ycore.GetPostData(id, null, (err, res) => {
|
const payload = {post_id: id}
|
||||||
|
ycore.comty_post.get((err,res)=>{
|
||||||
if (err) { return false }
|
if (err) { return false }
|
||||||
ycore.SecondarySwap.openPost(res)
|
ycore.SecondarySwap.openPost(res)
|
||||||
})
|
}, payload)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount(){
|
componentDidMount(){
|
||||||
|
@ -25,12 +25,16 @@ class SearchPageIndexer extends PureComponent {
|
|||||||
const parsed = matchSearch.shift()
|
const parsed = matchSearch.shift()
|
||||||
const raw = parsed.toString()
|
const raw = parsed.toString()
|
||||||
const string = raw.replace('/s/', "")
|
const string = raw.replace('/s/', "")
|
||||||
ycore.SeachKeywords(string, (exception, response) => {
|
|
||||||
ycore.yconsole.log('Founded entries => ', JSON.parse(response))
|
const payload = {key: string}
|
||||||
exception? ycore.notifyError(exception) : null
|
ycore.comty_search.keywords((err,res) =>{
|
||||||
this.setState({ SearchResult: response })
|
if (err) {
|
||||||
|
ycore.notifyError(err)
|
||||||
|
}
|
||||||
|
ycore.yconsole.log('Founded entries => ', JSON.parse(res))
|
||||||
|
this.setState({ SearchResult: res })
|
||||||
this.toogleLoading()
|
this.toogleLoading()
|
||||||
})
|
}, payload)
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ycore.notifyError(err)
|
ycore.notifyError(err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user