Правки различные
This commit is contained in:
@@ -74,6 +74,19 @@ export function AppProvider({ children }: { children: React.ReactNode }) {
|
||||
try {
|
||||
await SecureStore.setItemAsync(PENDING_CONSENTS_KEY, JSON.stringify(consents));
|
||||
const result = await beginAuthorization();
|
||||
if (getAccessToken()) {
|
||||
setAuthStatus("authenticated");
|
||||
await SecureStore.deleteItemAsync(PENDING_CONSENTS_KEY);
|
||||
return true;
|
||||
}
|
||||
if (result.type === "dismiss" || result.type === "cancel") {
|
||||
await new Promise((resolve) => setTimeout(resolve, 800));
|
||||
if (getAccessToken()) {
|
||||
setAuthStatus("authenticated");
|
||||
await SecureStore.deleteItemAsync(PENDING_CONSENTS_KEY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (result.type !== "success" || typeof result.params.code !== "string" || typeof result.params.state !== "string") {
|
||||
setAuthStatus("guest");
|
||||
if (result.type !== "dismiss" && result.type !== "cancel") throw new Error("authorization_failed");
|
||||
|
||||
Reference in New Issue
Block a user