|
|
|
@ -30,38 +30,20 @@ export async function getDocs(): Promise<Doc[] | null> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getLocalApiKey(): Promise<string | null> {
|
|
|
|
|
try {
|
|
|
|
|
export function getLocalApiKey(): string | null {
|
|
|
|
|
const key = localStorage.getItem('DocsGPTApiKey');
|
|
|
|
|
return key;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getLocalRecentDocs(): Promise<string | null> {
|
|
|
|
|
try {
|
|
|
|
|
export function getLocalRecentDocs(): string | null {
|
|
|
|
|
const doc = localStorage.getItem('DocsGPTRecentDocs');
|
|
|
|
|
return doc;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function setLocalApiKey(key: string): Promise<void> {
|
|
|
|
|
try {
|
|
|
|
|
export function setLocalApiKey(key: string): void {
|
|
|
|
|
localStorage.setItem('DocsGPTApiKey', key);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function setLocalRecentDocs(doc: Doc): Promise<void> {
|
|
|
|
|
try {
|
|
|
|
|
export function setLocalRecentDocs(doc: Doc): void {
|
|
|
|
|
localStorage.setItem('DocsGPTRecentDocs', JSON.stringify(doc));
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|