Skip to content

Instantly share code, notes, and snippets.

@astrotars
Created September 2, 2020 19:18
Show Gist options
  • Save astrotars/ec93b4f4aa7db4093a6635523abe1a72 to your computer and use it in GitHub Desktop.
Save astrotars/ec93b4f4aa7db4093a6635523abe1a72 to your computer and use it in GitHub Desktop.
import React from "react";
import { withRouter } from "react-router";
export default (Component, unAuthed = false) => {
const WithSession = ({ user = {}, streamToken, ...props }) =>
user.id || unAuthed ? (
<Component
userId={user.id}
user={user}
session={window.streamSession}
{...props}
/>
) : (
<Component {...props} />
);
return withRouter(WithSession);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment