chore: add roadmap slug

fix/ai-slug
Arik Chakma 7 months ago
parent 961d398b8d
commit d00aa4a2c6
  1. 9
      src/components/GenerateRoadmap/GenerateRoadmap.tsx

@ -263,6 +263,7 @@ export function GenerateRoadmap(props: GenerateRoadmapProps) {
const { response, error } = await httpPost<{ const { response, error } = await httpPost<{
roadmapId: string; roadmapId: string;
roadmapSlug: string;
}>( }>(
`${import.meta.env.PUBLIC_API_URL}/v1-save-ai-roadmap/${currentRoadmap?.id}`, `${import.meta.env.PUBLIC_API_URL}/v1-save-ai-roadmap/${currentRoadmap?.id}`,
{ {
@ -293,7 +294,7 @@ export function GenerateRoadmap(props: GenerateRoadmapProps) {
setIsLoading(false); setIsLoading(false);
pageProgressMessage.set(''); pageProgressMessage.set('');
return response.roadmapId; return response.roadmapSlug;
}; };
const downloadGeneratedRoadmapContent = async () => { const downloadGeneratedRoadmapContent = async () => {
@ -685,9 +686,9 @@ export function GenerateRoadmap(props: GenerateRoadmapProps) {
<button <button
className="inline-flex items-center justify-center gap-2 rounded-md bg-gray-200 py-1.5 pl-2.5 pr-3 text-xs font-medium text-black transition-colors duration-300 hover:bg-gray-300 sm:text-sm" className="inline-flex items-center justify-center gap-2 rounded-md bg-gray-200 py-1.5 pl-2.5 pr-3 text-xs font-medium text-black transition-colors duration-300 hover:bg-gray-300 sm:text-sm"
onClick={async () => { onClick={async () => {
const roadmapId = await saveAIRoadmap(); const roadmapSlug = await saveAIRoadmap();
if (roadmapId) { if (roadmapSlug) {
window.location.href = `/r?id=${roadmapId}`; window.location.href = `/r/${roadmapSlug}`;
} }
}} }}
disabled={isLoading} disabled={isLoading}

Loading…
Cancel
Save