mirror of
https://github.com/desktop/desktop
synced 2024-10-31 11:59:53 +00:00
Keep the user store in the shared process.
This commit is contained in:
parent
d6b6b298f4
commit
3619a49c60
4 changed files with 12 additions and 2 deletions
|
@ -1,11 +1,16 @@
|
|||
import {ipcRenderer, remote} from 'electron'
|
||||
import {Message} from './message'
|
||||
import tokenStore from './token-store'
|
||||
import UsersStore from './users-store'
|
||||
|
||||
const {BrowserWindow} = remote
|
||||
|
||||
type SharedProcessFunction = (args: any) => Promise<any>
|
||||
const registeredFunctions: {[key: string]: SharedProcessFunction} = {}
|
||||
|
||||
const usersStore = new UsersStore(localStorage, tokenStore)
|
||||
usersStore.loadFromStore()
|
||||
|
||||
register('console/log', ({args}: {args: any[]}) => {
|
||||
console.log('', ...args)
|
||||
return Promise.resolve()
|
||||
|
@ -20,6 +25,11 @@ register('ping', () => {
|
|||
return Promise.resolve('pong')
|
||||
})
|
||||
|
||||
register('users/get', () => {
|
||||
// TODO: Not quite right. Gotta go to JSON.
|
||||
return Promise.resolve(usersStore.getUsers())
|
||||
})
|
||||
|
||||
ipcRenderer.on('shared/request', (event, args) => {
|
||||
dispatch(args[0])
|
||||
})
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import {Emitter, Disposable} from 'event-kit'
|
||||
|
||||
import {DataStore, SecureStore} from './stores'
|
||||
import {getKeyForUser} from './auth'
|
||||
import User from './user'
|
||||
import {getKeyForUser} from '../auth'
|
||||
import User from '../user'
|
||||
|
||||
export default class UsersStore {
|
||||
private dataStore: DataStore
|
Loading…
Reference in a new issue