Finish axios migration via shared native HTTP helper

Replace all in-scope axios callsites with a new helpers/http.js wrapper over native fetch, including JSON/text GET, JSON POST, HEAD checks, and transient 5xx retry behavior; update all browser, build, script, and proxy API clients to use it; add focused unit tests; and remove axios from package dependencies.

Constraint: Preserve API/build and deployment behavior while lowering transport surface area.

Rejected: inline fetch replacements at each callsite | rejected to avoid inconsistent error/retry semantics.

Confidence: high

Scope-risk: moderate

Directive: Keep helper in place as the transport boundary and update tests when changing request semantics.

Tested: pnpm run -s typecheck, pnpm -s run test-prebuild, pnpm -s run test, pnpm -s run test:browser, pnpm -s run netlify-build, smoke GETs on /apple-silicon-app-test and /apple-silicon-app-test/?version=2

Not-tested: branch/netlify deployment health in CI pipeline after merge
This commit is contained in:
ThatGuySam 2026-04-06 12:09:16 -05:00
parent d39a2a1d6c
commit d45b587434
25 changed files with 824 additions and 267 deletions

View file

@ -59,10 +59,10 @@
<script>
import axios from 'axios'
import { v4 as uuid } from 'uuid'
import { isNuxt } from '~/helpers/environment.js'
import { postJson } from '~/helpers/http.js'
export default {
props: {
@ -142,31 +142,16 @@ export default {
console.log('actionUrl', actionUrl)
axios({
method: 'post',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
url: actionUrl,
data: {
try {
await postJson( actionUrl, {
// Email
'email': this.email
},
}).then( response => {
} )
this.feedbackMessage = 'We\'ll keep you informed!'
// console.log('response', response)
// if (response.status === 200) {
// this.feedbackMessage = '- We\'ll keep an eye on it for you!'
// } else {
// this.feedbackMessage = 'Oops! Something went wrong'
// }
}).catch( error => {
} catch ( error ) {
console.warn('error', error)
this.feedbackMessage = 'Something went wrong. Try refreshing. '
})
}
// .catch(error => {
// // handle error

View file

@ -59,8 +59,6 @@
<script>
import axios from 'axios'
export default {
props: {
appName: {
@ -121,31 +119,16 @@ export default {
const formActionUrl = `https://docs.google.com/forms/d/e/1FAIpQLSdWUAVabT3i1ExfnPgRKnk-s-aWLlOuy0d5JjMKDwKtrwXj1Q/formResponse?entry.710297191=${this.appName}&emailAddress=${this.email}&submit=Submit`
axios({
method: 'get',
url: formActionUrl,
// data: {
// // Email
// 'emailAddress': this.email,
// // App Name
// 'entry.710297191': this.appName,
// // Notes
// // 'entry.2040856090': '',
// 'submit': 'Submit'
// },
}).finally( response => {
try {
await fetch( formActionUrl, {
method: 'GET',
mode: 'no-cors'
} )
} catch ( error ) {
console.warn( 'Error Subscribing -', error )
} finally {
this.feedbackMessage = 'We\'ll keep an eye on it for you!'
// console.log('response', response)
// if (response.status === 200) {
// this.feedbackMessage = '- We\'ll keep an eye on it for you!'
// } else {
// this.feedbackMessage = 'Oops! Something went wrong'
// }
})
}
// .catch(error => {
// // handle error