fix: sse post no token

pull/12372/head
AkaraChen 2 years ago
parent 20357beda4
commit a059660ed8

@ -326,10 +326,15 @@ export const ssePost = (
} = otherOptions } = otherOptions
const abortController = new AbortController() const abortController = new AbortController()
const token = localStorage.getItem('console_token')
const options = Object.assign({}, baseOptions, { const options = Object.assign({}, baseOptions, {
method: 'POST', method: 'POST',
signal: abortController.signal, signal: abortController.signal,
}, fetchOptions) headers: new Headers({
Authorization: `Bearer ${token}`,
}),
} as RequestInit, fetchOptions)
const contentType = (options.headers as Headers).get('Content-Type') const contentType = (options.headers as Headers).get('Content-Type')
if (!contentType) if (!contentType)

Loading…
Cancel
Save