Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate Quiz for chosen Session #85

Merged
merged 3 commits into from
Sep 18, 2024
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
12 changes: 6 additions & 6 deletions src/app/(home)/Table/Actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
import { absoluteLink } from '@/lib/utils';
import { patchSession } from '@/services/services';
import { patchSession, sendRegenerateSns } from '@/services/services';
import { type Session, STATUS } from '@/types';
import { AlertTriangle, Copy, LinkIcon, Loader, MoreHorizontal } from 'lucide-react';
import Link from 'next/link';
Expand Down Expand Up @@ -62,12 +62,12 @@ const TableActions = ({ session }: { session: Session }) => {
{session.is_active ? 'Disable' : 'Enable'} Session
</Button>
</DropdownMenuItem>
{/* <DropdownMenuItem asChild className="cursor-pointer">
<DropdownMenuItem asChild className='cursor-pointer'>
<Button
variant="ghost"
className="w-full focus-visible:ring-0 justify-start font-normal"
variant='ghost'
className='w-full focus-visible:ring-0 justify-start font-normal'
onClick={() => {
sendCreateSns(session.id);
sendRegenerateSns(session.id);
toast.success('Request send successfully', {
description:
'The links will be available/updated shortly. Please refresh the page after a while.',
Expand All @@ -76,7 +76,7 @@ const TableActions = ({ session }: { session: Session }) => {
>
Regenerate Links
</Button>
</DropdownMenuItem> */}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
);
Expand Down
2 changes: 2 additions & 0 deletions src/services/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ export async function createSession(formData: Session) {

export const sendCreateSns = (id?: number) => publishMessage({ action: 'db_id', id });

export const sendRegenerateSns = (id?: number) => publishMessage({ action: 'regenerate_quiz', id });

/**
* Patches a session on the server.
* @param {Session} formData - The session data to be patched.
Expand Down
Loading