Correction secure store
This commit is contained in:
parent
4be37ac303
commit
1f4cfe0b77
@ -1,4 +1,4 @@
|
||||
import SecureStore from '@/utils/SecureStore'
|
||||
import * as SecureStore from '@/utils/SecureStore'
|
||||
import { useRouter } from 'expo-router'
|
||||
import { FAB, List, Surface } from 'react-native-paper'
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import SecureStore from "@/utils/SecureStore"
|
||||
import * as SecureStore from "@/utils/SecureStore"
|
||||
import { useRouter } from "expo-router"
|
||||
import { useRef, useState } from "react"
|
||||
import { Platform } from "react-native"
|
||||
@ -43,7 +43,10 @@ export default function Login() {
|
||||
SecureStore.setItem("apiPassword", password)
|
||||
}
|
||||
SecureStore.setItem("apiToken", resp.accessToken)
|
||||
router.back()
|
||||
if (router.canGoBack())
|
||||
router.back()
|
||||
else
|
||||
router.navigate('/')
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -1,3 +0,0 @@
|
||||
import * as SecureStore from 'expo-secure-store'
|
||||
|
||||
export default SecureStore
|
@ -1,17 +1,3 @@
|
||||
export function getItem(key: string): string | null {
|
||||
return localStorage.getItem(key)
|
||||
}
|
||||
import { getItem, getItemAsync, setItem, setItemAsync } from 'expo-secure-store'
|
||||
|
||||
export async function getItemAsync(key: string): Promise<string | null> {
|
||||
return localStorage.getItem(key)
|
||||
}
|
||||
|
||||
export function setItem(key: string, value: string): void {
|
||||
localStorage.setItem(key, value)
|
||||
}
|
||||
|
||||
export async function setItemAsync(key: string, value: string): Promise<void> {
|
||||
localStorage.setItem(key, value)
|
||||
}
|
||||
|
||||
export default { getItem, getItemAsync, setItem, setItemAsync }
|
||||
export { getItem, getItemAsync, setItem, setItemAsync }
|
||||
|
15
client/utils/SecureStore.web.ts
Normal file
15
client/utils/SecureStore.web.ts
Normal file
@ -0,0 +1,15 @@
|
||||
export function getItem(key: string): string | null {
|
||||
return localStorage.getItem(key)
|
||||
}
|
||||
|
||||
export async function getItemAsync(key: string): Promise<string | null> {
|
||||
return localStorage.getItem(key)
|
||||
}
|
||||
|
||||
export function setItem(key: string, value: string): void {
|
||||
localStorage.setItem(key, value)
|
||||
}
|
||||
|
||||
export async function setItemAsync(key: string, value: string): Promise<void> {
|
||||
localStorage.setItem(key, value)
|
||||
}
|
Loading…
Reference in New Issue
Block a user