From f079ae2a7b932b1e2a40a87a27fefcc6d3f34406 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 2 Apr 2018 12:51:17 +0430 Subject: [PATCH] feat: handle invalid strategy --- lib/core/auth.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/core/auth.js b/lib/core/auth.js index fcd5b74cf..60d4d26f6 100644 --- a/lib/core/auth.js +++ b/lib/core/auth.js @@ -35,6 +35,16 @@ export default class Auth { // Restore strategy this.$storage.syncUniversal('strategy', this.options.defaultStrategy) + // Set default strategy if current one is invalid + if (!this.strategy) { + this.$storage.setUniversal('strategy', this.options.defaultStrategy) + + // Give up if still invalid + if (!this.strategy) { + return Promise.resolve() + } + } + // Call mounted for active strategy on initial load return this.mounted() }