Changeset View
Changeset View
Standalone View
Standalone View
lib/actions/user-actions.js
Show All 9 Lines | import type { | ||||
UpdateUserSettingsRequest, | UpdateUserSettingsRequest, | ||||
PolicyAcknowledgmentRequest, | PolicyAcknowledgmentRequest, | ||||
} from '../types/account-types.js'; | } from '../types/account-types.js'; | ||||
import type { | import type { | ||||
UpdateUserAvatarRequest, | UpdateUserAvatarRequest, | ||||
UpdateUserAvatarResponse, | UpdateUserAvatarResponse, | ||||
} from '../types/avatar-types.js'; | } from '../types/avatar-types.js'; | ||||
import type { GetSessionPublicKeysArgs } from '../types/request-types.js'; | import type { GetSessionPublicKeysArgs } from '../types/request-types.js'; | ||||
import type { UserSearchResult } from '../types/search-types.js'; | import type { | ||||
UserSearchResult, | |||||
ExactUserSearchResult, | |||||
} from '../types/search-types.js'; | |||||
import type { | import type { | ||||
SessionPublicKeys, | SessionPublicKeys, | ||||
PreRequestUserState, | PreRequestUserState, | ||||
} from '../types/session-types.js'; | } from '../types/session-types.js'; | ||||
import type { | import type { | ||||
SubscriptionUpdateRequest, | SubscriptionUpdateRequest, | ||||
SubscriptionUpdateResult, | SubscriptionUpdateResult, | ||||
} from '../types/subscription-types.js'; | } from '../types/subscription-types.js'; | ||||
▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | async usernamePrefix => { | ||||
const response = await callServerEndpoint('search_users', { | const response = await callServerEndpoint('search_users', { | ||||
prefix: usernamePrefix, | prefix: usernamePrefix, | ||||
}); | }); | ||||
return { | return { | ||||
userInfos: response.userInfos, | userInfos: response.userInfos, | ||||
}; | }; | ||||
}; | }; | ||||
const exactSearchUserActionTypes = Object.freeze({ | |||||
started: 'EXACT_SEARCH_USER_STARTED', | |||||
success: 'EXACT_SEARCH_USER_SUCCESS', | |||||
failed: 'EXACT_SEARCH_USER_FAILED', | |||||
}); | |||||
const exactSearchUser = | |||||
( | |||||
callServerEndpoint: CallServerEndpoint, | |||||
): ((username: string) => Promise<ExactUserSearchResult>) => | |||||
async username => { | |||||
const response = await callServerEndpoint('exact_search_user', { | |||||
username, | |||||
}); | |||||
return { | |||||
userInfo: response.userInfo, | |||||
}; | |||||
}; | |||||
const updateSubscriptionActionTypes = Object.freeze({ | const updateSubscriptionActionTypes = Object.freeze({ | ||||
started: 'UPDATE_SUBSCRIPTION_STARTED', | started: 'UPDATE_SUBSCRIPTION_STARTED', | ||||
success: 'UPDATE_SUBSCRIPTION_SUCCESS', | success: 'UPDATE_SUBSCRIPTION_SUCCESS', | ||||
failed: 'UPDATE_SUBSCRIPTION_FAILED', | failed: 'UPDATE_SUBSCRIPTION_FAILED', | ||||
}); | }); | ||||
const updateSubscription = | const updateSubscription = | ||||
( | ( | ||||
callServerEndpoint: CallServerEndpoint, | callServerEndpoint: CallServerEndpoint, | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | export { | ||||
logIn, | logIn, | ||||
logInActionTypes, | logInActionTypes, | ||||
logOut, | logOut, | ||||
logOutActionTypes, | logOutActionTypes, | ||||
register, | register, | ||||
registerActionTypes, | registerActionTypes, | ||||
searchUsers, | searchUsers, | ||||
searchUsersActionTypes, | searchUsersActionTypes, | ||||
exactSearchUser, | |||||
exactSearchUserActionTypes, | |||||
setUserSettings, | setUserSettings, | ||||
setUserSettingsActionTypes, | setUserSettingsActionTypes, | ||||
updateSubscription, | updateSubscription, | ||||
updateSubscriptionActionTypes, | updateSubscriptionActionTypes, | ||||
policyAcknowledgment, | policyAcknowledgment, | ||||
policyAcknowledgmentActionTypes, | policyAcknowledgmentActionTypes, | ||||
updateUserAvatarActionTypes, | updateUserAvatarActionTypes, | ||||
updateUserAvatar, | updateUserAvatar, | ||||
}; | }; |