feat: add in prettier and format code for consistency (#168)
This commit is contained in:
+18
-12
@@ -1,8 +1,8 @@
|
||||
import { ChatFolder, Conversation } from "@/types";
|
||||
import { ChatFolder, Conversation } from '@/types';
|
||||
|
||||
export const exportData = () => {
|
||||
let history = localStorage.getItem("conversationHistory");
|
||||
let folders = localStorage.getItem("folders");
|
||||
let history = localStorage.getItem('conversationHistory');
|
||||
let folders = localStorage.getItem('folders');
|
||||
|
||||
if (history) {
|
||||
history = JSON.parse(history);
|
||||
@@ -14,23 +14,29 @@ export const exportData = () => {
|
||||
|
||||
const data = {
|
||||
history,
|
||||
folders
|
||||
folders,
|
||||
};
|
||||
|
||||
const blob = new Blob([JSON.stringify(data)], { type: "application/json" });
|
||||
const blob = new Blob([JSON.stringify(data)], { type: 'application/json' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
link.download = "chatbot_ui_history.json";
|
||||
const link = document.createElement('a');
|
||||
link.download = 'chatbot_ui_history.json';
|
||||
link.href = url;
|
||||
link.style.display = "none";
|
||||
link.style.display = 'none';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(url);
|
||||
};
|
||||
|
||||
export const importData = (conversations: Conversation[], folders: ChatFolder[]) => {
|
||||
localStorage.setItem("conversationHistory", JSON.stringify(conversations));
|
||||
localStorage.setItem("selectedConversation", JSON.stringify(conversations[conversations.length - 1]));
|
||||
localStorage.setItem("folders", JSON.stringify(folders));
|
||||
export const importData = (
|
||||
conversations: Conversation[],
|
||||
folders: ChatFolder[],
|
||||
) => {
|
||||
localStorage.setItem('conversationHistory', JSON.stringify(conversations));
|
||||
localStorage.setItem(
|
||||
'selectedConversation',
|
||||
JSON.stringify(conversations[conversations.length - 1]),
|
||||
);
|
||||
localStorage.setItem('folders', JSON.stringify(folders));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user