Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
hive
wallet
Commits
a3e17795
Commit
a3e17795
authored
Aug 23, 2019
by
/ /\ / /\/
Browse files
bug-fix, export action constants from reducer if they have saga watchers
parent
97d1d4e1
Changes
2
Show whitespace changes
Inline
Side-by-side
src/app/redux/CommunityReducer.js
View file @
a3e17795
...
...
@@ -10,7 +10,7 @@ const SET_COMMUNITY_OWNER_ACCOUNT_NAME =
const
SET_COMMUNITY_OWNER_MASTER_PASSWORD
=
'
community/SET_COMMUNITY_OWNER_MASTER_PASSWORD
'
;
const
CREATE_COMMUNITY_ACCOUNT
=
'
community/CREATE_COMMUNITY_ACCOUNT
'
;
// Has saga.
export
const
CREATE_COMMUNITY_ACCOUNT
=
'
community/CREATE_COMMUNITY_ACCOUNT
'
;
// Has saga.
const
CREATE_COMMUNITY_ACCOUNT_PENDING
=
'
community/CREATE_COMMUNITY_ACCOUNT_PENDING
'
;
const
CREATE_COMMUNITY_ACCOUNT_ERROR
=
...
...
@@ -37,7 +37,6 @@ const defaultState = fromJS({
export
default
function
reducer
(
state
=
defaultState
,
action
)
{
const
payload
=
action
.
payload
;
switch
(
action
.
type
)
{
case
SET_COMMUNITY_TITLE
:
{
const
title
=
fromJS
(
payload
);
...
...
src/app/redux/CommunitySaga.js
View file @
a3e17795
import
{
call
,
put
,
takeLatest
,
select
}
from
'
redux-saga/effects
'
;
import
*
as
dsteem
from
'
dsteem
'
;
import
{
Client
,
PrivateKey
}
from
'
dsteem
'
;
import
*
as
communityActions
from
'
./CommunityReducer
'
;
import
{
wait
}
from
'
./MarketSaga
'
;
// TODO: use steem endpoint from env var.
const
dSteemClient
=
new
dsteem
.
Client
(
'
https://api.steemit.com
'
);
const
dSteemClient
=
new
Client
(
'
https://api.steemit.com
'
);
const
usernameSelector
=
state
=>
state
.
user
.
current
.
username
;
const
activeKeySelector
=
state
=>
state
.
user
.
current
.
pub_keys_used
.
active
;
const
communityTitleSelector
=
state
=>
state
.
community
.
communityTitle
;
const
generateAuth
=
(
user
,
pass
,
type
)
=>
{
const
key
=
dsteem
.
PrivateKey
.
fromLogin
(
user
,
pass
,
type
).
createPublic
();
const
key
=
PrivateKey
.
fromLogin
(
user
,
pass
,
type
).
createPublic
();
if
(
type
==
'
memo
'
)
return
key
;
return
{
weight_threshold
:
1
,
account_auths
:
[],
key_auths
:
[[
key
,
1
]]
};
};
...
...
@@ -34,10 +34,14 @@ const generateHivemindOperation = (
};
export
const
communityWatches
=
[
takeLatest
(
communityActions
.
createCommunityAccount
,
createCommunityAccount
),
takeLatest
(
communityActions
.
CREATE_COMMUNITY_ACCOUNT
,
createCommunityAccount
),
];
export
function
*
createCommunityAccount
(
createCommunityAction
)
{
debugger
;
yield
put
({
type
:
communityActions
.
createCommunityAccountPending
,
payload
:
true
,
...
...
@@ -67,7 +71,7 @@ export function* createCommunityAccount(createCommunityAction) {
// The client cannot submit custom_json and account_create in the same block. The easiest way around this, for now, is to pause for 3 seconds after the account is created before submitting the ops.
yield
call
(
wait
,
3000
);
// Call the custom ops sagas.
const
ownerPosting
=
dsteem
.
PrivateKey
.
fromLogin
(
const
ownerPosting
=
PrivateKey
.
fromLogin
(
community
,
password
,
'
posting
'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment