diff --git a/src/components/ConfigMenu/ConfigMenu.tsx b/src/components/ConfigMenu/ConfigMenu.tsx index 9bd0d2f..53e19b2 100644 --- a/src/components/ConfigMenu/ConfigMenu.tsx +++ b/src/components/ConfigMenu/ConfigMenu.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import useStore from '@store/store'; import CrossIcon2 from '@icon/CrossIcon2'; @@ -42,6 +42,15 @@ const ConfigMenu = () => { setOpenConfig(false); }; + useEffect(() => { + const storedApiKey = localStorage.getItem('apiKey'); + if (storedApiKey) { + setApiFree(false); + setApiKey(storedApiKey); + _setApiKey(storedApiKey); + } + }, []); + return openConfig ? (
@@ -61,7 +70,7 @@ const ConfigMenu = () => {
setApiFree(true)} @@ -80,7 +89,7 @@ const ConfigMenu = () => {
setApiFree(false)}