rikunarita-2 commited on
Commit
f12928e
·
verified ·
1 Parent(s): 5075e56

Create ApiKeyInput.tsx

Browse files
Files changed (1) hide show
  1. frontend/components/ApiKeyInput.tsx +26 -0
frontend/components/ApiKeyInput.tsx ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useEffect, useState } from 'react';
2
+ import { useTranslation } from 'next-i18next';
3
+
4
+ export default function ApiKeyInput() {
5
+ const { t } = useTranslation('common');
6
+ const [civitaiKey, setCivitaiKey] = useState('');
7
+ const [hfToken, setHfToken] = useState('');
8
+
9
+ useEffect(() => {
10
+ sessionStorage.setItem('civitai_key', civitaiKey);
11
+ sessionStorage.setItem('hf_token_manual', hfToken);
12
+ }, [civitaiKey, hfToken]);
13
+
14
+ return (
15
+ <div className="space-y-2">
16
+ <div>
17
+ <label className="block text-sm font-medium">{t('hf_token')} ({t('leave_blank_for_oauth')})</label>
18
+ <input type="password" value={hfToken} onChange={e => setHfToken(e.target.value)} className="mt-1 block w-full border rounded p-2" />
19
+ </div>
20
+ <div>
21
+ <label className="block text-sm font-medium">{t('civitai_key')}</label>
22
+ <input type="password" value={civitaiKey} onChange={e => setCivitaiKey(e.target.value)} className="mt-1 block w-full border rounded p-2" />
23
+ </div>
24
+ </div>
25
+ );
26
+ }