Skip to content

Instantly share code, notes, and snippets.

View AbhiAgarwal192's full-sized avatar

Abhi Agarwal AbhiAgarwal192

View GitHub Profile
@AbhiAgarwal192
AbhiAgarwal192 / cross-tab-storage.ts
Created July 22, 2021 11:18 — forked from werthdavid/cross-tab-storage.ts
Special Storage-Implementation that uses sessionStorage (like the default of the OAuth-library) but also sets a marker in localStorage so that other Browser-Tabs get notified when the user on this Tab logs out.
/**
* Special Storage-Implementation that uses sessionStorage (like the default of the
* OAuth-library) but also sets a marker in localStorage so that other Browser-Tabs
* get notified when the user on this Tab logs out.
*/
export class CrossTabStorage extends OAuthStorage {
readonly MARKER_KEY = "LOGGED_IN";
constructor() {
from flask import Flask
from flask import json as flaskjson
import json
import os
app = Flask(__name__)
@app.route('/healthcheck', methods=['GET'])
def health_check():
return 'Congratulations! The app is running.'
[
{"Title": "The Land Girls", "US Gross": 146083, "Worldwide Gross": 146083, "US DVD Sales": null, "Production Budget": 8000000, "Release Date": "Jun 12 1998", "MPAA Rating": "R", "Running Time min": null, "Distributor": "Gramercy", "Source": null, "Major Genre": null, "Creative Type": null, "Director": null, "Rotten Tomatoes Rating": null, "IMDB Rating": 6.1, "IMDB Votes": 1071},
{"Title": "First Love, Last Rites", "US Gross": 10876, "Worldwide Gross": 10876, "US DVD Sales": null, "Production Budget": 300000, "Release Date": "Aug 07 1998", "MPAA Rating": "R", "Running Time min": null, "Distributor": "Strand", "Source": null, "Major Genre": "Drama", "Creative Type": null, "Director": null, "Rotten Tomatoes Rating": null, "IMDB Rating": 6.9, "IMDB Votes": 207},
{"Title": "I Married a Strange Person", "US Gross": 203134, "Worldwide Gross": 203134, "US DVD Sales": null, "Production Budget": 250000, "Release Date": "Aug 28 1998", "MPAA Rating": null, "Running Time min": null, "Distributor": "Lionsgate
import React from 'react';
import MicrofrontEnd from './MicrofrontEnd';
function App() {
let host = process.env.REACT_APP_TABLE_HOST;
return (
<div>
<MicrofrontEnd host={host} name="Table"/>
</div>
import React, {Component} from 'react';
class MicrofrontEnd extends Component {
componentDidMount() {
const { host, name, document } = this.props;
const scriptId = `micro-frontend-script-${name}`;
if (document.getElementById(scriptId)) {
console.log("renderMF");
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import TableComponent from './Table/Table';
window.renderTable = (containerId) => {
ReactDOM.render(
<TableComponent />,
document.getElementById(containerId),
);
module.exports = (app) => {
app.use((req, res, next) => {
res.header("Access-Control-Allow-Origin", "*");
next();
});
};
module.exports = {
webpack: (config, env) => {
config.optimization.runtimeChunk = false;
config.optimization.splitChunks = {
cacheGroups: {
default: false,
},
};
config.output.filename = "static/js/[name].js";
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
import { Component } from "react"
import './Table.css';
class TableComponent extends Component{
render(){
return(
<div>
<table>
<tr>
<th>Company</th>