Skip to content

Commit

Permalink
Merge pull request #76 from storybookjs/valentin/fix-language-detection
Browse files Browse the repository at this point in the history
Fix language detection
  • Loading branch information
valentinpalkovic authored Jul 10, 2023
2 parents 7276282 + 4f74e6d commit 1fa4e72
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/features/WriteStoriesModal/hooks/useGetProject.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useEffect, useState } from "react";

import { Response } from "../../../types/response";
import dataJavascript from "../code/javascript";
import dataTypescript from "../code/typescript";
import { CodeSnippets } from "../code/types";
Expand All @@ -22,8 +21,8 @@ export function useGetProject() {
const getProject = async () => {
try {
const response = await fetch("/project.json");
const project: Response<Project> = await response.json();
const data = project?.data?.language === "javascript" ? dataJavascript : dataTypescript;
const project = await response.json() as Project;
const data = project?.language === "javascript" ? dataJavascript : dataTypescript;

setProject({
data,
Expand Down

0 comments on commit 1fa4e72

Please sign in to comment.