mirror of
https://github.com/wassname/talk.git
synced 2026-08-12 12:30:39 +08:00
refactor into using config reducer
This commit is contained in:
@@ -161,12 +161,12 @@ export default class Stream {
|
||||
);
|
||||
}
|
||||
|
||||
enableDebug() {
|
||||
this.pym.sendMessage('enableDebug');
|
||||
enablePluginsDebug() {
|
||||
this.pym.sendMessage('enablePluginsDebug');
|
||||
}
|
||||
|
||||
disableDebug() {
|
||||
this.pym.sendMessage('disableDebug');
|
||||
disablePluginsDebug() {
|
||||
this.pym.sendMessage('disablePluginsDebug');
|
||||
}
|
||||
|
||||
login(token) {
|
||||
|
||||
@@ -23,11 +23,11 @@ export default class StreamInterface {
|
||||
return this._stream.remove();
|
||||
}
|
||||
|
||||
enableDebug() {
|
||||
return this._stream.enableDebug();
|
||||
enablePluginsDebug() {
|
||||
return this._stream.enablePluginsDebug();
|
||||
}
|
||||
|
||||
disableDebug() {
|
||||
return this._stream.disableDebug();
|
||||
disablePluginsDebug() {
|
||||
return this._stream.disablePluginsDebug();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ export const mergeConfig = config => ({
|
||||
config,
|
||||
});
|
||||
|
||||
export const enablePlugins = () => ({
|
||||
export const enablePluginsDebug = () => ({
|
||||
type: ENABLE_PLUGINS_DEBUG,
|
||||
});
|
||||
|
||||
export const disablePlugins = () => ({
|
||||
export const disablePluginsDebug = () => ({
|
||||
type: DISABLE_PLUGINS_DEBUG,
|
||||
});
|
||||
|
||||
+9
-5
@@ -25,7 +25,11 @@ import { createIntrospection } from 'coral-framework/services/introspection';
|
||||
import introspectionData from 'coral-framework/graphql/introspection.json';
|
||||
import coreReducers from '../reducers';
|
||||
import { checkLogin as checkLoginAction } from '../actions/auth';
|
||||
import { mergeConfig, enableDebug, disableDebug } from '../actions/config';
|
||||
import {
|
||||
mergeConfig,
|
||||
enablePluginsDebug,
|
||||
disablePluginsDebug,
|
||||
} from '../actions/config';
|
||||
import { setAuthToken, logout } from '../actions/auth';
|
||||
|
||||
/**
|
||||
@@ -216,12 +220,12 @@ export async function createContext({
|
||||
store.dispatch(logout());
|
||||
});
|
||||
|
||||
pym.onMessage('enableDebug', () => {
|
||||
store.dispatch(enableDebug());
|
||||
pym.onMessage('enablePluginsDebug', () => {
|
||||
store.dispatch(enablePluginsDebug());
|
||||
});
|
||||
|
||||
pym.onMessage('disableDebug', () => {
|
||||
store.dispatch(disableDebug());
|
||||
pym.onMessage('disablePluginsDebug', () => {
|
||||
store.dispatch(disablePluginsDebug());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user