-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : api전달시 deviceType도 같이 보내도록 변경
- Loading branch information
Showing
4 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
import { DeviceType } from "../../../types/DeviceType"; | ||
import { LoginRequest } from "./LoginRequest"; | ||
|
||
export function loginRequestViaApp(data: LoginRequest): any { | ||
return { | ||
email: data.email, | ||
password: data.password | ||
password: data.password, | ||
deviceType: getDeviceType(), | ||
}; | ||
} | ||
|
||
function getDeviceType(): DeviceType { | ||
const userAgent = navigator.userAgent; | ||
|
||
if (/Android/i.test(userAgent)) { | ||
return DeviceType.ANDROID; | ||
} else if (/iPhone|iPad|iPod/i.test(userAgent)) { | ||
return DeviceType.IOS; | ||
} else if (/Windows NT/i.test(userAgent)) { | ||
return DeviceType.WINDOWS; | ||
} else if (/Macintosh/i.test(userAgent)) { | ||
return DeviceType.MAC; | ||
} else { | ||
return DeviceType.WEB_UNKNOWN; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export enum DeviceType { | ||
WEB_UNKNOWN = "WEB_UNKNOWN", | ||
ANDROID = "ANDROID", | ||
IOS = "IOS", | ||
WINDOWS = "WINDOWS", | ||
MAC = "MAC", | ||
} |