Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cloud/components/atoms/ServiceConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ServiceConnect = ({
children = 'Connect',
...buttonProps
}: ServiceConnectProps) => {
const { pushAxiosErrorMessage, pushMessage } = useToast()
const { pushApiErrorMessage, pushMessage } = useToast()
const childRef = useRef<Window | null>()

useEffect(() => {
Expand All @@ -36,7 +36,7 @@ const ServiceConnect = ({
)
onConnect(connection)
} catch (err) {
pushAxiosErrorMessage(err)
pushApiErrorMessage(err)
}
} else {
pushMessage({
Expand All @@ -53,7 +53,7 @@ const ServiceConnect = ({
return () => {
window.removeEventListener('message', callback)
}
}, [service, pushMessage, pushAxiosErrorMessage, onConnect])
}, [service, pushMessage, pushApiErrorMessage, onConnect])

const onClick = useCallback(() => {
if (childRef.current != null && childRef.current.closed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const ContentmanagerDocRow = ({
}: ContentManagerDocRowProps) => {
const [sending, setSending] = useState<ActionsIds>()
const { updateDocsMap, deleteDocHandler, updateDocHandler } = useNav()
const { pushMessage, pushAxiosErrorMessage } = useToast()
const { pushMessage, pushApiErrorMessage } = useToast()
const { openModal } = useModal()
const { permissions = [] } = usePage()

Expand Down Expand Up @@ -162,12 +162,12 @@ const ContentmanagerDocRow = ({
try {
await updateDocHandler(doc, { workspaceId, parentFolderId })
} catch (error) {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
}
setSending(undefined)
setUpdating((prev) => prev.filter((id) => id !== patternedId))
},
[updateDocHandler, updating, setUpdating, pushAxiosErrorMessage]
[updateDocHandler, updating, setUpdating, pushApiErrorMessage]
)

const openMoveForm = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const ContentmanagerFolderRow = ({
deleteFolderHandler,
updateFolderHandler,
} = useNav()
const { pushMessage, pushAxiosErrorMessage } = useToast()
const { pushMessage, pushApiErrorMessage } = useToast()
const { openModal } = useModal()

const toggleFolderBookmark = useCallback(
Expand Down Expand Up @@ -121,12 +121,12 @@ const ContentmanagerFolderRow = ({
emoji: 'unchanged',
})
} catch (error) {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
}
setSending(undefined)
setUpdating((prev) => prev.filter((id) => id !== patternedId))
},
[updateFolderHandler, updating, setUpdating, pushAxiosErrorMessage]
[updateFolderHandler, updating, setUpdating, pushApiErrorMessage]
)

const openMoveForm = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const TagsAutoCompleteInput = ({ team, doc }: TagsAutoCompleteInputProps) => {
const containerRef = useRef<HTMLDivElement>(null)
const { tagsMap, updateDocsMap, updateTagsMap } = useNav()
const [sending, setSending] = useState<boolean>(false)
const { pushAxiosErrorMessage } = useToast()
const { pushApiErrorMessage } = useToast()
const [tagText, setTagText] = useState<string>('')

useEffect(() => {
Expand All @@ -51,12 +51,12 @@ const TagsAutoCompleteInput = ({ team, doc }: TagsAutoCompleteInputProps) => {
setShowInput(false)
setTagText('')
} catch (error) {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
}

setSending(false)
},
[pushAxiosErrorMessage, sending, doc.id, team, updateDocsMap, updateTagsMap]
[pushApiErrorMessage, sending, doc.id, team, updateDocsMap, updateTagsMap]
)

const activateAndFocus = useCallback(() => {
Expand Down
6 changes: 3 additions & 3 deletions src/cloud/components/molecules/DocTagsList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const maxTagsDisplayed = 4

const DocTagsList = ({ doc, team }: DocTagsListProps) => {
const [sending, setSending] = useState<boolean>(false)
const { pushAxiosErrorMessage } = useToast()
const { pushApiErrorMessage } = useToast()
const { updateDocsMap } = useNav()
const [removing, setRemoving] = useState<string>()
const [expanded, setExpanded] = useState<boolean>(false)
Expand All @@ -41,12 +41,12 @@ const DocTagsList = ({ doc, team }: DocTagsListProps) => {
const { doc: newDoc } = await deleteTagFromDoc(team.id, doc.id, tagId)
updateDocsMap([newDoc.id, newDoc])
} catch (error) {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
}
setRemoving(undefined)
setSending(false)
},
[doc.id, team.id, sending, setSending, pushAxiosErrorMessage, updateDocsMap]
[doc.id, team.id, sending, setSending, pushApiErrorMessage, updateDocsMap]
)

const listContent = useMemo(() => {
Expand Down
6 changes: 3 additions & 3 deletions src/cloud/components/molecules/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const Editor = ({
revisionHistory,
}: EditorProps) => {
const { currentUserPermissions } = usePage()
const { pushMessage, pushAxiosErrorMessage } = useToast()
const { pushMessage, pushApiErrorMessage } = useToast()
const [color] = useState(() => getColorFromString(user.id))
const { preferences, setPreferences } = usePreferences()
const editorRef = useRef<CodeMirror.Editor | null>(null)
Expand Down Expand Up @@ -237,14 +237,14 @@ const Editor = ({
return { type: 'file', url, title: file.name }
}
} catch (err) {
pushAxiosErrorMessage(err)
pushApiErrorMessage(err)
return null
}
}
} else {
fileUploadHandlerRef.current = undefined
}
}, [team, pushMessage, pushAxiosErrorMessage, doc])
}, [team, pushMessage, pushApiErrorMessage, doc])

useEffect(() => {
return () => {
Expand Down
18 changes: 9 additions & 9 deletions src/cloud/components/molecules/OpenInviteSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const OpenInvitesSection = ({ userPermissions }: OpenInvitesSectionProps) => {
SerializedOpenInvite | undefined
>(undefined)
const { messageBox } = useDialog()
const { pushAxiosErrorMessage } = useToast()
const { pushApiErrorMessage } = useToast()

useEffectOnce(() => {
fetchOpenInvite()
Expand All @@ -53,9 +53,9 @@ const OpenInvitesSection = ({ userPermissions }: OpenInvitesSectionProps) => {
setOpenInvite(invite)
setFetching(false)
} catch (error) {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
}
}, [team, pushAxiosErrorMessage])
}, [team, pushApiErrorMessage])

const createInvite = useCallback(async () => {
if (team == null) {
Expand All @@ -67,10 +67,10 @@ const OpenInvitesSection = ({ userPermissions }: OpenInvitesSectionProps) => {
const { invite } = await createOpenInvite(team)
setOpenInvite(invite)
} catch (error) {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
}
setSending(false)
}, [team, pushAxiosErrorMessage])
}, [team, pushApiErrorMessage])

const cancelInvite = useCallback(
async (invite: SerializedOpenInvite) => {
Expand All @@ -94,7 +94,7 @@ const OpenInvitesSection = ({ userPermissions }: OpenInvitesSectionProps) => {
await cancelOpenInvite(team, invite)
setOpenInvite(undefined)
} catch (error) {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
}
setSending(false)
return
Expand All @@ -104,7 +104,7 @@ const OpenInvitesSection = ({ userPermissions }: OpenInvitesSectionProps) => {
},
})
},
[messageBox, t, team, pushAxiosErrorMessage]
[messageBox, t, team, pushApiErrorMessage]
)

const resetInvite = useCallback(async () => {
Expand All @@ -131,7 +131,7 @@ const OpenInvitesSection = ({ userPermissions }: OpenInvitesSectionProps) => {
)
setOpenInvite(newInvite)
} catch (error) {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
}
setSending(false)
return
Expand All @@ -140,7 +140,7 @@ const OpenInvitesSection = ({ userPermissions }: OpenInvitesSectionProps) => {
}
},
})
}, [messageBox, t, team, pushAxiosErrorMessage, openInvite])
}, [messageBox, t, team, pushApiErrorMessage, openInvite])

const toggleOpenInvite = useCallback(() => {
if (openInvite != null) {
Expand Down
4 changes: 2 additions & 2 deletions src/cloud/components/molecules/ServiceSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface ServiceSelectorProps {
type Services = 'github' | 'slack' | 'vercel'

const ServiceSelector = ({ onSelect }: ServiceSelectorProps) => {
const { pushAxiosErrorMessage } = useToast()
const { pushApiErrorMessage } = useToast()
const [connections, setConnections] = useState<SerializedServiceConnection[]>(
[]
)
Expand All @@ -38,7 +38,7 @@ const ServiceSelector = ({ onSelect }: ServiceSelectorProps) => {
const { connections } = await getUserServiceConnections()
setConnections(connections)
} catch (err) {
pushAxiosErrorMessage(err)
pushApiErrorMessage(err)
} finally {
setIsLoadingConnections(false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const UpdateBillingEmailForm = ({
onSuccess,
onCancel,
}: UpdateBillingEmailFormProps) => {
const { pushAxiosErrorMessage } = useToast()
const { pushApiErrorMessage } = useToast()
const [sending, setSending] = useState<boolean>(false)
const [email, setEmail] = useState<string>(sub != null ? sub.email : '')

Expand All @@ -37,7 +37,7 @@ const UpdateBillingEmailForm = ({
const { subscription } = await updateSubEmail(sub.teamId, email)
onSuccess(subscription)
} catch (error) {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
setSending(false)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const UpdateBillingMethodForm = ({
}: UpdateBillingMethodFormProps) => {
const stripe = useStripe()
const elements = useElements()
const { pushAxiosErrorMessage } = useToast()
const { pushApiErrorMessage } = useToast()
const [sending, setSending] = useState<boolean>(false)
const { settings } = useSettings()

Expand Down Expand Up @@ -59,7 +59,7 @@ const UpdateBillingMethodForm = ({
})
onSuccess(subscription)
} catch (error) {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
setSending(false)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const UpdateBillingPromoForm = ({
sub,
onCancel,
}: UpdateBillingPromoFormProps) => {
const { pushAxiosErrorMessage, pushMessage } = useToast()
const { pushApiErrorMessage, pushMessage } = useToast()
const [sending, setSending] = useState<boolean>(false)
const [promoCode, setPromoCode] = useState<string>('')

Expand All @@ -45,7 +45,7 @@ const UpdateBillingPromoForm = ({
description: `Promo code ${promoCode} is not available for this account`,
})
} else {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
}
} finally {
setSending(false)
Expand Down
4 changes: 2 additions & 2 deletions src/cloud/components/molecules/SubscriptionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const SubscriptionForm = ({
const [sending, setSending] = useState(false)
const { settings } = useSettings()
const { permissions = [] } = usePage()
const { pushAxiosErrorMessage } = useToast()
const { pushApiErrorMessage } = useToast()
const [currentPlan] = useState<UpgradePlans>(
initialPlan != null ? initialPlan : 'standard'
)
Expand Down Expand Up @@ -110,7 +110,7 @@ const SubscriptionForm = ({
setSending(false)
onSuccess(subscription)
} catch (error) {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
setSending(false)
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/cloud/components/organisms/FreeTrialPopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface FreeTrialPopupProps {
const FreeTrialPopup = ({ team, close }: FreeTrialPopupProps) => {
const [sending, setSending] = useState(false)
const { updateTeamSubscription } = usePage()
const { pushAxiosErrorMessage } = useToast()
const { pushApiErrorMessage } = useToast()

const onCloseCallback = useCallback(() => {
if (sending) {
Expand All @@ -38,10 +38,10 @@ const FreeTrialPopup = ({ team, close }: FreeTrialPopupProps) => {
updateTeamSubscription(subscription)
close()
} catch (error) {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
}
setSending(false)
}, [sending, pushAxiosErrorMessage, updateTeamSubscription, team, close])
}, [sending, pushApiErrorMessage, updateTeamSubscription, team, close])

return (
<StyledFreeTrialPopup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const ImportModal = () => {
const [uploadType, setUploadType] = useState<
AllowedDocTypeImports | undefined
>()
const { pushAxiosErrorMessage, pushMessage } = useToast()
const { pushApiErrorMessage, pushMessage } = useToast()
const { team, pageFolder, pageWorkspace, setPartialPageData } = usePage()
const [sending, setSending] = useState<boolean>(false)
const { updateDocsMap, updateFoldersMap, updateWorkspacesMap } = useNav()
Expand Down Expand Up @@ -125,7 +125,7 @@ const ImportModal = () => {
}
}
} catch (error) {
pushAxiosErrorMessage(error)
pushApiErrorMessage(error)
}
}
setSending(false)
Expand All @@ -134,7 +134,7 @@ const ImportModal = () => {
[
selectedWorkspaceId,
selectedFolderId,
pushAxiosErrorMessage,
pushApiErrorMessage,
team,
uploadType,
sending,
Expand Down
Loading