Files
raucao d837a1ffaa Remove success modal for Discourse connect
Also show error modals on failed reconnect
2026-10-08 20:45:55 +02:00

30 lines
868 B
JavaScript

import Route from '@ember/routing/route';
import { service } from '@ember/service';
export default class AuthDiscourseCallbackRoute extends Route {
@service authorization;
@service integrationResult;
@service router;
@service sites;
async model() {
try {
const integration = await this.authorization.completeWebCallback(
'discourse',
window.location.href
);
// The site list was loaded before the callback activated the record, so
// rebuild it and re-resolve this forum's icon from the network.
await this.sites.reload();
await this.sites.refreshIcon(integration.url);
} catch (error) {
console.error('Error processing Discourse callback:', error);
this.integrationResult.show({ error: error.message });
}
}
afterModel() {
return this.router.replaceWith('index');
}
}