Skip to content

Commit

Permalink
Adding buildNumber and appVersion to login data
Browse files Browse the repository at this point in the history
  • Loading branch information
Bri74 authored and lpezzolla committed Feb 26, 2024
1 parent f755d26 commit 217a1e8
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions src/core/queries/authHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,40 @@ export const useLogin = () => {

return useMutation({
mutationFn: (dto: LoginRequest) => {
dto.client = { name: 'Students app' };
const client = { name: 'Students app' };

return Promise.all([
DeviceInfo.getDeviceName(),
DeviceInfo.getModel(),
DeviceInfo.getManufacturer(),
DeviceInfo.getBuildNumber(),
DeviceInfo.getVersion(),
isEnvProduction ? messaging().getToken() : undefined,
])
.then(([name, model, manufacturer, fcmRegistrationToken]) => {
dto.device = {
.then(
([
name,
platform: Platform.OS,
version: `${Platform.Version}`,
model,
manufacturer,
};
dto.preferences = { ...dto.preferences, fcmRegistrationToken };
})
buildNumber,
appVersion,
fcmRegistrationToken,
]) => {
dto.device = {
name,
platform: Platform.OS,
version: `${Platform.Version}`,
model,
manufacturer,
};
dto.client = {
...client,
buildNumber,
appVersion,
};
dto.preferences = { ...dto.preferences, fcmRegistrationToken };
},
)
.then(() => authClient.login({ loginRequest: dto }))
.then(pluckData)
.then(res => {
Expand Down

0 comments on commit 217a1e8

Please sign in to comment.