mirror of
https://github.com/wassname/talk.git
synced 2026-09-09 11:38:08 +08:00
Create load stream by id route
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
import {graphql} from 'react-apollo';
|
||||
import STREAM_QUERY from './streamQuery.graphql';
|
||||
import pym from 'coral-framework/PymConnection';
|
||||
|
||||
let url = pym.parentUrl.split('#')[0] || 'http://localhost:3000/';
|
||||
function getQueryVariable(variable) {
|
||||
let query = window.location.search.substring(1);
|
||||
let vars = query.split('&');
|
||||
for (let i = 0; i < vars.length; i++) {
|
||||
let pair = vars[i].split('=');
|
||||
if (decodeURIComponent(pair[0]) === variable) {
|
||||
return decodeURIComponent(pair[1]);
|
||||
}
|
||||
}
|
||||
console.log('Query variable %s not found', variable);
|
||||
}
|
||||
|
||||
export const queryStream = graphql(STREAM_QUERY, {
|
||||
options: {variables: {asset_url: url}}
|
||||
options: {variables: {asset_url: getQueryVariable('asset_url')}}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user