Fix auth verification flow and alert ID fallback
This commit is contained in:
+7
-4
@@ -46,14 +46,14 @@ export async function restoreSession(store) {
|
||||
}
|
||||
|
||||
try {
|
||||
await verifyConnection(store);
|
||||
return await verifyConnection(store);
|
||||
} catch (error) {
|
||||
if (!isAuthFailure(error)) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return store.session;
|
||||
return { session: store.session, kitchens: [] };
|
||||
}
|
||||
|
||||
export async function logout(store) {
|
||||
@@ -80,13 +80,16 @@ export async function verifyConnection(store) {
|
||||
}
|
||||
|
||||
try {
|
||||
await listKitchens(store);
|
||||
const kitchens = await listKitchens(store);
|
||||
store.setSession({
|
||||
...store.session,
|
||||
state: CONNECTION_STATES.connected,
|
||||
hasValidated: true,
|
||||
});
|
||||
return store.session;
|
||||
return {
|
||||
session: store.session,
|
||||
kitchens,
|
||||
};
|
||||
} catch (error) {
|
||||
if (!isAuthFailure(error)) {
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user