Make Store a generic class (#74617)
This commit is contained in:
parent
d37ad20894
commit
16900dcef1
27 changed files with 106 additions and 97 deletions
|
@ -6,7 +6,7 @@ from datetime import timedelta
|
|||
from ipaddress import ip_address
|
||||
import logging
|
||||
import secrets
|
||||
from typing import Final
|
||||
from typing import Any, Final
|
||||
|
||||
from aiohttp import hdrs
|
||||
from aiohttp.web import Application, Request, StreamResponse, middleware
|
||||
|
@ -118,8 +118,8 @@ def async_user_not_allowed_do_auth(
|
|||
|
||||
async def async_setup_auth(hass: HomeAssistant, app: Application) -> None:
|
||||
"""Create auth middleware for the app."""
|
||||
store = Store(hass, STORAGE_VERSION, STORAGE_KEY)
|
||||
if (data := await store.async_load()) is None or not isinstance(data, dict):
|
||||
store = Store[dict[str, Any]](hass, STORAGE_VERSION, STORAGE_KEY)
|
||||
if (data := await store.async_load()) is None:
|
||||
data = {}
|
||||
|
||||
refresh_token = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue