mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-18 01:20:05 +00:00
chore(*): use axios instead of fetch
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
export const parseAndSubmitAuthorizeForm = async (
|
export const parseAndSubmitAuthorizeForm = async (
|
||||||
response: string,
|
response: string,
|
||||||
serverUrl: string
|
serverUrl: string
|
||||||
@@ -30,20 +32,11 @@ export const parseAndSubmitAuthorizeForm = async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
if (!authUrl) {
|
||||||
if (authUrl) {
|
throw new Error('Auth Form URL is null or undefined.')
|
||||||
fetch(authUrl, {
|
}
|
||||||
method: 'POST',
|
|
||||||
credentials: 'include',
|
return await axios
|
||||||
body: formData,
|
.post(authUrl, formData, { withCredentials: true, responseType: 'text' })
|
||||||
referrerPolicy: 'same-origin'
|
.then((response) => response.data)
|
||||||
})
|
|
||||||
.then((res) => res.text())
|
|
||||||
.then((res) => {
|
|
||||||
resolve(res)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
reject('Auth form url is null')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user