mirror of
https://github.com/halo-dev/theme-earth.git
synced 2025-10-15 15:20:33 +00:00
Update logout url
This commit is contained in:
@@ -1,18 +0,0 @@
|
|||||||
export default () => ({
|
|
||||||
async handleLogout() {
|
|
||||||
if (confirm("确定要退出登录吗?")) {
|
|
||||||
await fetch(`/logout`, {
|
|
||||||
method: "POST",
|
|
||||||
credentials: "same-origin",
|
|
||||||
headers: {
|
|
||||||
"X-Xsrf-Token":
|
|
||||||
document.cookie
|
|
||||||
.split("; ")
|
|
||||||
.find((row) => row.startsWith("XSRF-TOKEN"))
|
|
||||||
?.split("=")[1] || "",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
@@ -6,7 +6,6 @@ import dropdown from "./alpine-data/dropdown";
|
|||||||
import colorSchemeSwitcher from "./alpine-data/color-scheme-switcher";
|
import colorSchemeSwitcher from "./alpine-data/color-scheme-switcher";
|
||||||
import upvote from "./alpine-data/upvote";
|
import upvote from "./alpine-data/upvote";
|
||||||
import share from "./alpine-data/share";
|
import share from "./alpine-data/share";
|
||||||
import logout from "./alpine-data/logout";
|
|
||||||
import uiPermission from "./alpine-data/ui-permission";
|
import uiPermission from "./alpine-data/ui-permission";
|
||||||
|
|
||||||
window.Alpine = Alpine;
|
window.Alpine = Alpine;
|
||||||
@@ -17,7 +16,6 @@ Alpine.data("colorSchemeSwitcher", colorSchemeSwitcher);
|
|||||||
Alpine.data("upvote", upvote);
|
Alpine.data("upvote", upvote);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
Alpine.data("share", share);
|
Alpine.data("share", share);
|
||||||
Alpine.data("logout", logout);
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
Alpine.data("uiPermission", uiPermission);
|
Alpine.data("uiPermission", uiPermission);
|
||||||
|
|
||||||
|
@@ -130,14 +130,13 @@
|
|||||||
<li
|
<li
|
||||||
sec:authorize="isAuthenticated()"
|
sec:authorize="isAuthenticated()"
|
||||||
class="flex w-full items-center text-left text-sm hover:bg-gray-50 dark:hover:bg-slate-600"
|
class="flex w-full items-center text-left text-sm hover:bg-gray-50 dark:hover:bg-slate-600"
|
||||||
x-data="logout"
|
|
||||||
@click="handleLogout"
|
|
||||||
>
|
>
|
||||||
<span
|
<a
|
||||||
class="size-full truncate px-4 py-2 text-gray-600 hover:text-blue-600 dark:text-slate-50 dark:hover:text-gray-300"
|
class="size-full truncate px-4 py-2 text-gray-600 hover:text-blue-600 dark:text-slate-50 dark:hover:text-gray-300"
|
||||||
|
href="/logout"
|
||||||
>
|
>
|
||||||
退出登录
|
退出登录
|
||||||
</span>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
sec:authorize="isAnonymous()"
|
sec:authorize="isAnonymous()"
|
||||||
|
Reference in New Issue
Block a user