Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anime watch history is now saved to local history #19

Merged
merged 2 commits into from
May 9, 2024

Conversation

zephex-alt
Copy link
Contributor

And if you want to access this data, use the following code:

	const [localItems, setLocalItems] = useState(null);

	useEffect(() => {
		const newData = get_local();
		setLocalItems(newData);
	}, []); // Empty dependency array means this effect runs only once after the initial render

	function get_local() {
		try {
			const data = localStorage.getItem("watchHistory");
			return JSON.parse(data);
		} catch (error) {
			console.log("error", error);
			return false;
		}
	}

Copy link

vercel bot commented May 9, 2024

@zephex-alt is attempting to deploy a commit to the avalynndev Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented May 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
animunet ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 9, 2024 5:08am

@avalynndev
Copy link
Member

You haven't created a LocalStorage File..?

Module not found: Can't resolve './LocalStorage'

@zephex-alt
Copy link
Contributor Author

You haven't created a LocalStorage File..?

Module not found: Can't resolve './LocalStorage'

Ohh, my bad.

I forgot to git add *

@zephex-alt
Copy link
Contributor Author

Check now

@@ -2,107 +2,132 @@ import React, { useState } from "react";
import Link from "next/link";
import { SelectItem, Select, Button } from "@nextui-org/react"; // Assuming Button component is defined elsewhere
import PetIcon from "@/components/Icons/PetIcon";
import SaveToLocalStorage from "./LocalStorage";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also can you define this LocalStorage file in utils folder (create one).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also can you define this LocalStorage file in utils folder (create one).

You can. Just make sure that you are importing it correctly.

@avalynndev avalynndev merged commit c6589fe into InfiniteDevs:main May 9, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants