mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Clean up type errors
This commit is contained in:
parent
4d0f1bec88
commit
7c1178b6e0
1 changed files with 6 additions and 5 deletions
|
|
@ -2,19 +2,20 @@ import { ContentHandler, PreHandleResult } from '../content-handler'
|
|||
import axios from 'axios'
|
||||
import _ from 'underscore'
|
||||
|
||||
const getRedirectUrl = async (url: string): Promise<string | null> => {
|
||||
const getRedirectUrl = async (url: string): Promise<string | undefined> => {
|
||||
try {
|
||||
const response = await axios.get(url, {
|
||||
maxRedirects: 0,
|
||||
validateStatus: (status) => status === 302,
|
||||
})
|
||||
return response.headers.location as string
|
||||
return response.headers.location
|
||||
} catch (error: any) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
if (error.response && error.response.headers.location) {
|
||||
return error.response.headers.location
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
return error.response.headers.location as string
|
||||
}
|
||||
console.error('No redirect or network error occurred:', error.message)
|
||||
return null
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue