Merge pull request 'upd: login ios' (#7) from amalia/28-jul-25 into join

Reviewed-on: bip/mobile-darmasaba#7
This commit is contained in:
2025-07-29 10:09:55 +08:00

View File

@@ -55,9 +55,11 @@ export default function AuthProvider({ children }: { children: ReactNode }): Rea
const hasil = await decryptToken(String(token)) const hasil = await decryptToken(String(token))
const permission = await requestPermission() const permission = await requestPermission()
if (permission) { if (permission) {
const tokenDevice = await getToken()
try { try {
const register = await apiRegisteredToken({ user: hasil, token: String(tokenDevice) }) if (Platform.OS === 'android') {
const tokenDevice = await getToken()
const register = await apiRegisteredToken({ user: hasil, token: String(tokenDevice) })
}
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} finally { } finally {
@@ -77,7 +79,7 @@ export default function AuthProvider({ children }: { children: ReactNode }): Rea
try { try {
const hasil = await decryptToken(String(tokenRef.current)) const hasil = await decryptToken(String(tokenRef.current))
const token = await getToken() const token = await getToken()
if (Platform.OS === 'android'){ if (Platform.OS === 'android') {
const response = await apiUnregisteredToken({ user: hasil, token: String(token) }) const response = await apiUnregisteredToken({ user: hasil, token: String(token) })
} }
} catch (error) { } catch (error) {