fix: campaign wizard using wrong localStorage key for auth token
Was reading `auth_token`, should be `encryptid-token`. Also removes the premature client-side auth guard that blocked signed-in users. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7f327eb07a
commit
90d511077c
|
|
@ -129,7 +129,7 @@ export class FolkCampaignWizard extends HTMLElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async apiFetch(path: string, opts: RequestInit = {}): Promise<Response> {
|
private async apiFetch(path: string, opts: RequestInit = {}): Promise<Response> {
|
||||||
const token = (window as any).__authToken || localStorage.getItem('auth_token') || '';
|
const token = (window as any).__authToken || localStorage.getItem('encryptid-token') || '';
|
||||||
return fetch(`${this.basePath}${path}`, {
|
return fetch(`${this.basePath}${path}`, {
|
||||||
...opts,
|
...opts,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -170,12 +170,6 @@ export class FolkCampaignWizard extends HTMLElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async createWizard(): Promise<string | null> {
|
private async createWizard(): Promise<string | null> {
|
||||||
const token = (window as any).__authToken || localStorage.getItem('auth_token') || '';
|
|
||||||
if (!token) {
|
|
||||||
this._error = 'Please sign in to create a campaign wizard';
|
|
||||||
this.render();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
const res = await this.apiFetch('/api/campaign/wizard', {
|
const res = await this.apiFetch('/api/campaign/wizard', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue