fix moment locales bug
This commit is contained in:
@@ -6,6 +6,13 @@ import { connect } from 'react-redux'
|
|||||||
import { Input, InputLabel, MenuItem, Select, Theme } from '@material-ui/core'
|
import { Input, InputLabel, MenuItem, Select, Theme } from '@material-ui/core'
|
||||||
import { settingsActions } from '../../actions'
|
import { settingsActions } from '../../actions'
|
||||||
import { withStyles } from '@material-ui/styles'
|
import { withStyles } from '@material-ui/styles'
|
||||||
|
|
||||||
|
function importAll(r: any) {
|
||||||
|
r.keys().forEach(r);
|
||||||
|
}
|
||||||
|
// @ts-expect-error -- webpack require
|
||||||
|
importAll(require.context('moment/locale', true, /\.js$/));
|
||||||
|
|
||||||
const moment = require('moment')
|
const moment = require('moment')
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|||||||
@@ -13,16 +13,14 @@ export class Rpc {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let id = v4();
|
let id = v4();
|
||||||
|
|
||||||
let responseEvent: Event<any> = { topic: `${event.topic}/response` };
|
let responseEvent: Event<any> = { topic: `${event.topic}/response/${id}` };
|
||||||
let requestEvent: Event<any> = { topic: `${event.topic}/request` };
|
let requestEvent: Event<any> = { topic: `${event.topic}/request` };
|
||||||
let callback = (result: { id: string; payload: RpcResponse; error: unknown }) => {
|
let callback = (result: { id: string; payload: RpcResponse; error: unknown }) => {
|
||||||
this.participant.unsubscribe(responseEvent as any, callback);
|
this.participant.unsubscribe(responseEvent as any, callback);
|
||||||
if (result.id === id) {
|
if (result.error) {
|
||||||
if (result.error) {
|
reject(result.error)
|
||||||
reject(result.error)
|
} else {
|
||||||
} else {
|
resolve(result.payload);
|
||||||
resolve(result.payload);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
console.log("received", result)
|
console.log("received", result)
|
||||||
};
|
};
|
||||||
@@ -47,8 +45,9 @@ export class Rpc {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e
|
error = e
|
||||||
}
|
}
|
||||||
console.log("Responding with", payload, error)
|
const id = (request as any).id
|
||||||
this.participant.emit({ topic: `${event.topic}/response` }, { id: (request as any).id, payload, error });
|
console.log(`${event.topic}/response/${id}`, payload, error)
|
||||||
|
this.participant.emit({ topic: `${event.topic}/response/${id}` }, { id, payload, error });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user