Skip to content

πŸ”΄ 2. Frontend: Inconsistent Session HandlingΒ #156

@juancolchete

Description

@juancolchete

Location: templates/add_area.html:418

async function fetchIssueData(issueId){
    let response = await fetch(`api/gitea/get-issue/${issueId}`)  // ❌ Wrong
    let issue = await response.json()
    return issue.data
}

Problem: Uses fetch() instead of apiFetch() wrapper. All other API calls in this file use apiFetch() which handles session expiration properly.

Fix:

async function fetchIssueData(issueId){
    try {
        let response = await apiFetch(`/api/gitea/get-issue/${issueId}`)  // βœ… Use apiFetch
        let result = await response.json()
        
        if (!response.ok || result.error) {
            throw new Error(result.error || 'Failed to fetch issue data')
        }
        
        return result.data
    } catch (error) {
        if (error.message === 'Session expired') throw error;
        showToast('Error', `Failed to load issue #${issueId}: ${error.message}`, 'error')
        throw error
    }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions