Skip to content

Commit

Permalink
refactor: give callback a more speaking name
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Dec 7, 2023
1 parent 573bde2 commit cdc18fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const useFileActionsCopyQuickLink = ({ store }: { store?: Store<any> } =
const { canShare } = useCanShare()
const { copyToClipboard } = useClipboard()

const callback = async (result: PromiseSettledResult<Share>[]) => {
const onLinkCreatedCallback = async (result: PromiseSettledResult<Share>[]) => {
const link = result.find(
(val): val is PromiseFulfilledResult<Share> => val.status === 'fulfilled'
)
Expand All @@ -37,7 +37,7 @@ export const useFileActionsCopyQuickLink = ({ store }: { store?: Store<any> } =

const { actions: createLinkActions } = useFileActionsCreateLink({
store,
callback,
onLinkCreatedCallback,
showMessages: false
})
const createQuicklinkAction = computed<FileAction>(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export const useFileActionsCreateLink = ({
store,
enforceModal = false,
showMessages = true,
callback = undefined
onLinkCreatedCallback = undefined
}: {
store?: Store<any>
enforceModal?: boolean
showMessages?: boolean
callback?: (result: PromiseSettledResult<Share>[]) => Promise<void> | void
onLinkCreatedCallback?: (result: PromiseSettledResult<Share>[]) => Promise<void> | void
} = {}) => {
const { $gettext, $ngettext } = useGettext()
const ability = useAbility()
Expand Down Expand Up @@ -53,8 +53,8 @@ export const useFileActionsCreateLink = ({
})
}

if (callback) {
callback(result)
if (onLinkCreatedCallback) {
onLinkCreatedCallback(result)
}
}

Expand Down

0 comments on commit cdc18fd

Please sign in to comment.