mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Dont crash if a popular read is not available on signup
This commit is contained in:
parent
d7023beef0
commit
5312c31ea7
2 changed files with 21 additions and 15 deletions
|
|
@ -72,6 +72,7 @@ export async function createMobileEmailSignUpResponse(
|
|||
json: {},
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('error', e)
|
||||
return signUpFailedPayload
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,22 +32,27 @@ const popularRead = (key: string): PopularRead | undefined => {
|
|||
return undefined
|
||||
}
|
||||
|
||||
const content = readFileSync(
|
||||
path.resolve(__dirname, `popular_reads/${key}-content.html`),
|
||||
'utf8'
|
||||
)
|
||||
const originalHtml = readFileSync(
|
||||
path.resolve(__dirname, `./popular_reads/${key}-original.html`),
|
||||
'utf8'
|
||||
)
|
||||
if (!content || !originalHtml) {
|
||||
return undefined
|
||||
}
|
||||
try {
|
||||
const content = readFileSync(
|
||||
path.resolve(__dirname, `popular_reads/${key}-content.html`),
|
||||
'utf8'
|
||||
)
|
||||
const originalHtml = readFileSync(
|
||||
path.resolve(__dirname, `./popular_reads/${key}-original.html`),
|
||||
'utf8'
|
||||
)
|
||||
if (!content || !originalHtml) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
return {
|
||||
...metadata,
|
||||
content,
|
||||
originalHtml,
|
||||
return {
|
||||
...metadata,
|
||||
content,
|
||||
originalHtml,
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('error adding popular read', e)
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue