Skip to content

Commit

Permalink
add: haswallet cookie and throttle adduser
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpy committed Sep 30, 2020
1 parent 159df62 commit 39aaabb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/RouterSelector.web.js
Expand Up @@ -115,6 +115,9 @@ const NestedRouter = memo(({ isLoggedIn }) => {

useEffect(() => {
log.debug('RouterSelector Rendered', { isLoggedIn })
if (isLoggedIn) {
document.cookie = 'hasWallet=1;Domain=.gooddollar.org'
}
}, [isLoggedIn])

return isLoggedIn ? (
Expand Down
6 changes: 3 additions & 3 deletions src/lib/API/api.js
Expand Up @@ -2,7 +2,7 @@

import axios from 'axios'
import type { $AxiosXHR, AxiosInstance, AxiosPromise } from 'axios'
import { identity, isError, isPlainObject, isString } from 'lodash'
import { identity, isError, isPlainObject, isString, throttle } from 'lodash'

import AsyncStorage from '../../lib/utils/asyncStorage'
import Config from '../../config/config'
Expand Down Expand Up @@ -148,14 +148,14 @@ export class APIService {
* `/user/add` post api call
* @param {UserRecord} user
*/
addUser(user: UserRecord): AxiosPromise<any> {
addUser = throttle((user: UserRecord): AxiosPromise<any> => {
//-skipRegistrationStep ONLY FOR TESTING delete this condition aftere testing
return this.client.post(
'/user/add',
{ user, skipRegistrationStep: global.skipRegistrationStep },
{ withCredentials: true }, //we need also the cookies for utm
)
}
}, 1000)

/**
* `/user/delete` post api call
Expand Down

0 comments on commit 39aaabb

Please sign in to comment.