Skip to content

Commit

Permalink
Merge pull request #234 from Hexastack/fix/config-type
Browse files Browse the repository at this point in the history
fix(frontend): config context typing
  • Loading branch information
yassinedorbozgithub authored Oct 18, 2024
2 parents 2adfc01 + 353fe88 commit 57a04da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/src/contexts/config.context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
*/

import { useState, useEffect, createContext } from "react";
import { createContext, useEffect, useState } from "react";

export const ConfigContext = createContext<IConfig | null>(null);

Expand All @@ -16,13 +16,13 @@ export interface IConfig {
}

export const ConfigProvider = ({ children }) => {
const [config, setConfig] = useState(null);
const [config, setConfig] = useState<IConfig | null>(null);

useEffect(() => {
const fetchConfig = async () => {
try {
const res = await fetch("/config");
const data = await res.json();
const data = (await res.json()) as IConfig;

setConfig(data);
} catch (error) {
Expand Down

0 comments on commit 57a04da

Please sign in to comment.