* Check if this campaign should redirect to HackStack and return redirect info * @returns {Object|null} Redirect info object or null if no redirect needed
()
| 2602 | * @returns {Object|null} Redirect info object or null if no redirect needed |
| 2603 | */ |
| 2604 | checkHackstackRedirect () { |
| 2605 | try { |
| 2606 | const isHackstackType = this.campaign?.get('type') === 'hackstack' || this.campaign?.get('isHackstackCampaign') |
| 2607 | const alreadyOnAIPath = /^\/ai\/play\//.test(location.pathname) |
| 2608 | if (isHackstackType && !alreadyOnAIPath && !this.editorMode) { |
| 2609 | const slug = this.campaign.get('slug') || this.terrain |
| 2610 | return { slug, dest: `/ai/play/${slug}` } |
| 2611 | } |
| 2612 | } catch (e) { |
| 2613 | // no-op |
| 2614 | } |
| 2615 | return null |
| 2616 | } |
| 2617 | |
| 2618 | /** |
| 2619 | * Execute HackStack redirect after all loading is complete |