feat: 🎸 Add migration check to delete index DB when updating (#2241)

* feat: 🎸 Add migration check to delete index DB when updating

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13223
This commit is contained in:
Zhihe Li authored and GitHub committed 2025-02-13 11:00:19 -05:00
1 parent f3232f34c2
commit 20c4bbcee2
6 files changed
+33 -19

No files matched your search

+7 -5
View File
@@ -15,13 +15,15 @@ export default class SessionService extends BaseSessionService {
* Extend ember simple auth's handleAuthentication method
* so we can hook in and setup the DB after a successful authentication
*/
handleAuthentication() {
super.handleAuthentication(...arguments);
async handleAuthentication() {
const userId = this.data?.authenticated?.user_id;
const hostUrl = this.window.location.host;
const hostUrl = this.window.location?.host;
if (userId && hostUrl) {
this.indexedDb.setup(formatDbName(userId, hostUrl));
await this.indexedDb.setup(formatDbName(userId, hostUrl));
}
// We let ember-simple-auth handle transitioning back to the index after authentication.
// This route can be configured in our environment config.
super.handleAuthentication(...arguments);
}
}