add country to User and create doUserSetCountry #97
4 changed files with 38 additions and 0 deletions
20
dist/bundle.es.js
vendored
20
dist/bundle.es.js
vendored
|
@ -1978,6 +1978,25 @@ function doUserSetReferrer(referrer, shouldClaim) {
|
|||
}
|
||||
};
|
||||
}
|
||||
function doUserSetCountry(country) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const user = selectUser(state);
|
||||
Lbryio.call('user_country', 'set', {
|
||||
country
|
||||
}).then(() => {
|
||||
const newUser = { ...user,
|
||||
country
|
||||
};
|
||||
dispatch({
|
||||
type: USER_FETCH_SUCCESS,
|
||||
data: {
|
||||
user: newUser
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
function doClaimYoutubeChannels() {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
|
@ -4042,6 +4061,7 @@ exports.doUserPhoneReset = doUserPhoneReset;
|
|||
exports.doUserPhoneVerify = doUserPhoneVerify;
|
||||
exports.doUserPhoneVerifyFailure = doUserPhoneVerifyFailure;
|
||||
exports.doUserResendVerificationEmail = doUserResendVerificationEmail;
|
||||
exports.doUserSetCountry = doUserSetCountry;
|
||||
exports.doUserSetReferrer = doUserSetReferrer;
|
||||
exports.doUserSetReferrerReset = doUserSetReferrerReset;
|
||||
exports.doUserSignIn = doUserSignIn;
|
||||
|
|
1
flow-typed/User.js
vendored
1
flow-typed/User.js
vendored
|
@ -3,6 +3,7 @@
|
|||
type DeviceType = 'mobile' | 'web' | 'desktop';
|
||||
|
||||
declare type User = {
|
||||
country: ?string,
|
||||
created_at: string,
|
||||
family_name: ?string,
|
||||
given_name: ?string,
|
||||
|
|
|
@ -74,6 +74,7 @@ export {
|
|||
doUserCheckIfEmailExists,
|
||||
doClearEmailEntry,
|
||||
doClearPasswordEntry,
|
||||
doUserSetCountry,
|
||||
} from 'redux/actions/user';
|
||||
export { doFetchCostInfoForUri } from 'redux/actions/cost_info';
|
||||
export { doBlackListedOutpointsSubscribe } from 'redux/actions/blacklist';
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
selectEmailToVerify,
|
||||
selectPhoneToVerify,
|
||||
selectUserCountryCode,
|
||||
selectUser,
|
||||
} from 'redux/selectors/user';
|
||||
import rewards from 'rewards';
|
||||
import Lbryio from 'lbryio';
|
||||
|
@ -703,6 +704,21 @@ export function doUserSetReferrer(referrer, shouldClaim) {
|
|||
};
|
||||
}
|
||||
|
||||
export function doUserSetCountry(country) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const user = selectUser(state);
|
||||
|
||||
Lbryio.call('user_country', 'set', { country }).then(() => {
|
||||
const newUser = { ...user, country };
|
||||
dispatch({
|
||||
type: ACTIONS.USER_FETCH_SUCCESS,
|
||||
data: { user: newUser },
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doClaimYoutubeChannels() {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
|
|
Loading…
Reference in a new issue