2024-01-21 23:08:25 +08:00
|
|
|
// Settings.tsx
|
|
|
|
import { useAppDispatch, useAppSelector } from "@/app/store";
|
|
|
|
import { setApiKey } from "@/app/store/slices/authSlice";
|
|
|
|
|
|
|
|
const Settings = () => {
|
|
|
|
const dispatch = useAppDispatch();
|
2024-01-22 08:53:58 +08:00
|
|
|
const apiKey = useAppSelector((state) => state.auth.apiKey);
|
2024-01-21 23:08:25 +08:00
|
|
|
|
|
|
|
return (
|
2024-01-22 08:53:58 +08:00
|
|
|
<div className="max-w-md mx-auto p-4">
|
|
|
|
<div className="mb-4">
|
|
|
|
<label
|
|
|
|
className="block text-gray-700 text-sm font-bold mb-2"
|
|
|
|
htmlFor="api-key"
|
|
|
|
>
|
|
|
|
API Key:
|
|
|
|
</label>
|
2024-01-21 23:08:25 +08:00
|
|
|
<input
|
2024-01-22 08:53:58 +08:00
|
|
|
id="api-key"
|
2024-01-21 23:08:25 +08:00
|
|
|
type="text"
|
|
|
|
value={apiKey}
|
|
|
|
onChange={(event) => dispatch(setApiKey(event.target.value))}
|
2024-01-22 08:53:58 +08:00
|
|
|
className="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
|
2024-01-21 23:08:25 +08:00
|
|
|
/>
|
2024-01-22 08:53:58 +08:00
|
|
|
</div>
|
2024-01-21 23:08:25 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Settings;
|