diff --git a/src/views/Home/Navbar/Laptop/index.js b/src/views/Home/Navbar/Laptop/index.js index 1d839b3..73f1685 100644 --- a/src/views/Home/Navbar/Laptop/index.js +++ b/src/views/Home/Navbar/Laptop/index.js @@ -25,6 +25,17 @@ const fontSize = { }, }; +const changeLanguage = (val) => { + if (val === "fa") { + localStorage.removeItem("language"); + } else if (val === "en") { + localStorage.setItem("language", "en"); + } else { + localStorage.setItem("language", "ar"); + } + window.location.reload(); +}; + class LaptopNavbar extends Component { state = {}; @@ -129,7 +140,11 @@ class LaptopNavbar extends Component { {window.t("خروج")}{" "} - changeLanguage(e.target.value)} + defaultValue={localStorage.getItem("language") || "fa"} + > {["fa", "en", "ar"].map((lang, index) => ( ))} @@ -162,7 +177,11 @@ class LaptopNavbar extends Component { ) : (
- changeLanguage(e.target.value)} + defaultValue={localStorage.getItem("language") || "fa"} + > {["fa", "en", "ar"].map((lang, index) => ( ))}