mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add refetch capability to contributor status hook and update course actions to utilize it
This commit is contained in:
parent
b6059f8d5c
commit
837e5842c5
2 changed files with 33 additions and 32 deletions
|
|
@ -193,7 +193,7 @@ const Actions = ({ courseuuid, orgslug, course }: CourseActionsProps) => {
|
|||
const [isContributeLoading, setIsContributeLoading] = useState(false)
|
||||
const [isModalOpen, setIsModalOpen] = useState(false)
|
||||
const [hasAccess, setHasAccess] = useState<boolean | null>(null)
|
||||
const { contributorStatus } = useContributorStatus(courseuuid);
|
||||
const { contributorStatus, refetch } = useContributorStatus(courseuuid);
|
||||
|
||||
const isStarted = course.trail?.runs?.some(
|
||||
(run) => run.status === 'STATUS_IN_PROGRESS' && run.course_id === course.id
|
||||
|
|
@ -306,6 +306,7 @@ const Actions = ({ courseuuid, orgslug, course }: CourseActionsProps) => {
|
|||
|
||||
await applyForContributor('course_' + courseuuid, data, session.data?.tokens?.access_token)
|
||||
await revalidateTags(['courses'], orgslug)
|
||||
await refetch()
|
||||
toast.success('Your application to contribute has been submitted successfully', { id: loadingToast })
|
||||
} catch (error) {
|
||||
console.error('Failed to apply as contributor:', error)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue