🐛 (usage) Fix storage limit check
This commit is contained in:
committed by
Baptiste Arnaud
parent
1063429275
commit
1e26703ad4
@@ -1,4 +1,6 @@
|
||||
body {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
|
||||
Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
||||
}
|
||||
|
||||
@@ -26,10 +26,7 @@ export const ErrorPage = ({ error }: { error: Error }) => {
|
||||
</h2>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<h1 style={{ fontWeight: 'bold', fontSize: '30px' }}>{error.name}</h1>
|
||||
<h2>{error.message}</h2>
|
||||
</>
|
||||
<p style={{ fontSize: '24px' }}>{error.message}</p>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -100,7 +100,7 @@ export const TypebotPage = ({
|
||||
const handleNewAnswer = async (
|
||||
answer: Answer & { uploadedFiles: boolean }
|
||||
) => {
|
||||
if (!resultId) return setError(new Error('Result was not created'))
|
||||
if (!resultId) return setError(new Error('Error: result was not created'))
|
||||
const { error } = await upsertAnswer({ ...answer, resultId })
|
||||
if (error) setError(error)
|
||||
if (chatStarted) return
|
||||
@@ -110,7 +110,7 @@ export const TypebotPage = ({
|
||||
}
|
||||
|
||||
const handleCompleted = async () => {
|
||||
if (!resultId) return setError(new Error('Result was not created'))
|
||||
if (!resultId) return setError(new Error('Error: result was not created'))
|
||||
const { error } = await updateResult(resultId, { isCompleted: true })
|
||||
if (error) setError(error)
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ const checkStorageLimit = async (typebotId: string) => {
|
||||
if (!totalStorageUsed) return false
|
||||
const hasSentFirstEmail = workspace.storageLimitFirstEmailSentAt !== null
|
||||
const hasSentSecondEmail = workspace.storageLimitSecondEmailSentAt !== null
|
||||
const storageLimit = getStorageLimit(typebot.workspace)
|
||||
const storageLimit = getStorageLimit(typebot.workspace) * 1024 * 1024 * 1024
|
||||
if (
|
||||
totalStorageUsed >= storageLimit * LIMIT_EMAIL_TRIGGER_PERCENT &&
|
||||
!hasSentFirstEmail &&
|
||||
|
||||
Reference in New Issue
Block a user