Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/actions/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import {
convertToPlace,
getPersistenceMode,
isHomeOrWork,
isNewUser,
positionHomeAndWorkFirst,
setAtLeastNoMobilityDevice,
tidyRecentSearches
tidyRecentSearches,
userExistsInDatabase
} from '../util/user'
import {
formattedToastSuccessMessage,
Expand Down Expand Up @@ -391,7 +391,7 @@ export function createOrUpdateUser(userData, intl) {
)

// Determine URL and method to use.
const isCreatingUser = isNewUser(loggedInUser)
const isCreatingUser = userExistsInDatabase(loggedInUser)
if (isCreatingUser) {
requestUrl = `${apiBaseUrl}${API_OTPUSER_PATH}`
method = 'POST'
Expand Down
4 changes: 4 additions & 0 deletions lib/util/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export function isNewUser(loggedInUser) {
return !loggedInUser.hasConsentedToTerms
}

export function userExistsInDatabase(loggedInUser) {
return !loggedInUser.id
}

// Helper functions to determine if
// a location is home or work.
export const isHome = (loc) => loc.type === 'home'
Expand Down
Loading