aboutsummaryrefslogtreecommitdiff
path: root/src/app/anime/components/saveToLocalStorage.js
diff options
context:
space:
mode:
authorreal-zephex <[email protected]>2024-05-24 22:51:36 +0530
committerreal-zephex <[email protected]>2024-05-24 22:51:36 +0530
commit180c9577f8337991ca71470816333fe8430cd3ca (patch)
tree82caa5a920443bcf0db3746c7ecacd968d4fc148 /src/app/anime/components/saveToLocalStorage.js
parentstyle: minor improvements to the anime cards (diff)
downloaddramalama-180c9577f8337991ca71470816333fe8430cd3ca.tar.xz
dramalama-180c9577f8337991ca71470816333fe8430cd3ca.zip
✨ feat(ui): 🎨 migrate from vanilla css to tailwind css, adopted next ui and restructured
Diffstat (limited to 'src/app/anime/components/saveToLocalStorage.js')
-rw-r--r--src/app/anime/components/saveToLocalStorage.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/app/anime/components/saveToLocalStorage.js b/src/app/anime/components/saveToLocalStorage.js
new file mode 100644
index 0000000..313b157
--- /dev/null
+++ b/src/app/anime/components/saveToLocalStorage.js
@@ -0,0 +1,29 @@
+"use client";
+
+import { storeLocal } from "./storeHistory";
+
+export default function store_to_local(name, image, episode, id) {
+ const currentDate = new Date();
+
+ try {
+ let newData = {
+ name: name,
+ image: image,
+ episode: episode,
+ id: id,
+ type: "anime",
+ date: `${currentDate.getDate()}-${String(
+ currentDate.getMonth() + 1
+ ).padStart(2, "0")}`,
+ time: `${currentDate.getHours()}:${String(
+ currentDate.getMinutes()
+ ).padStart(2, "0")}`,
+ };
+ storeLocal(newData);
+ } catch (error) {
+ console.error(
+ "Some error occurred during the process of saving your watch history to local storage. Please try again or contact us on GitHub if this issue persists.",
+ error.message
+ );
+ }
+}