Skip to content

Replace axios with fetch in frontend request paths - #1838

Open
nning with Copilot wants to merge 5 commits into
mainfrom
copilot/remove-axios-replace-with-fetch
Open

Replace axios with fetch in frontend request paths#1838
nning with Copilot wants to merge 5 commits into
mainfrom
copilot/remove-axios-replace-with-fetch

Conversation

Copilot AI commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

This PR removes axios from the client bundle and migrates existing request callsites to native fetch. The goal is to keep current request/response behavior while dropping the extra dependency.

  • Request client migration

    • Replaced Axios.put(...) in AsyncCheckbox with fetch (PUT, FormData, same-origin credentials, X-Requested-With header).
    • Replaced Axios.post(...) in Upload with fetch (POST, FormData, same request headers/credentials).
  • Behavior compatibility

    • Kept upload response handling aligned with existing code by returning { data: ... }-shaped results from the new fetch path.
    • Preserved existing upload error surface by mapping request failures into the current per-file errors structure.
  • Failure handling improvements

    • Added explicit non-2xx status checks with actionable error messages.
    • For async checkbox updates, request failure now reverts the toggled value and reports an inline validity error to the user.
  • Dependency cleanup

    • Removed axios from package.json and regenerated yarn.lock.
// Before
Axios.put(uri, data)

// After
fetch(uri, {
  method: 'PUT',
  headers: { 'X-Requested-With': 'XMLHttpRequest' },
  body: data,
  credentials: 'same-origin'
})

Copilot AI and others added 5 commits April 16, 2026 05:48
Agent-Logs-Url: https://github.com/nning/imgshr/sessions/e88f5855-b2bc-46d2-b422-836a256b9e32

Co-authored-by: nning <557430+nning@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nning/imgshr/sessions/e88f5855-b2bc-46d2-b422-836a256b9e32

Co-authored-by: nning <557430+nning@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nning/imgshr/sessions/e88f5855-b2bc-46d2-b422-836a256b9e32

Co-authored-by: nning <557430+nning@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants