mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Keep user signed in during onboarding (#17669)
This commit is contained in:
parent
7e7205627a
commit
3249a5225f
@ -27,6 +27,11 @@ import { registerServiceWorker } from "../util/register-service-worker";
|
||||
import "./onboarding-analytics";
|
||||
import "./onboarding-create-user";
|
||||
import "./onboarding-loading";
|
||||
import {
|
||||
enableWrite,
|
||||
loadTokens,
|
||||
saveTokens,
|
||||
} from "../common/auth/token_storage";
|
||||
|
||||
type OnboardingEvent =
|
||||
| {
|
||||
@ -212,6 +217,8 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
|
||||
const auth = await getAuth({
|
||||
hassUrl,
|
||||
limitHassInstance: true,
|
||||
saveTokens,
|
||||
loadTokens: () => Promise.resolve(loadTokens()),
|
||||
});
|
||||
history.replaceState(null, "", location.pathname);
|
||||
await this._connectHass(auth);
|
||||
@ -235,11 +242,13 @@ class HaOnboarding extends litLocalizeLiteMixin(HassElement) {
|
||||
if (stepResult.type === "user") {
|
||||
const result = stepResult.result as OnboardingResponses["user"];
|
||||
this._loading = true;
|
||||
enableWrite();
|
||||
try {
|
||||
const auth = await getAuth({
|
||||
hassUrl,
|
||||
limitHassInstance: true,
|
||||
authCode: result.auth_code,
|
||||
saveTokens,
|
||||
});
|
||||
await this._connectHass(auth);
|
||||
} catch (err: any) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user