add country to User and create doUserSetCountry

This commit is contained in:
Sean Yesmunt 2020-06-01 12:27:07 -04:00
parent 39510e8b21
commit 0529fb4635
4 changed files with 38 additions and 0 deletions

20
dist/bundle.es.js vendored
View file

@ -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
View file

@ -3,6 +3,7 @@
type DeviceType = 'mobile' | 'web' | 'desktop';
declare type User = {
country: ?string,
created_at: string,
family_name: ?string,
given_name: ?string,

View file

@ -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';

View file

@ -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({