mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-12 21:08:46 +00:00
로그인 페이지에서 Token Refresh 성공시의 자동 리다이렉션 구현
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const refreshToken = async () => {
|
||||
export const refreshToken = async () => {
|
||||
return await fetch("/api/auth/refreshToken", { method: "POST" });
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { goto } from "$app/navigation";
|
||||
import { Button, TextButton } from "$lib/components/buttons";
|
||||
import { TitleDiv, BottomDiv } from "$lib/components/divs";
|
||||
import { TextInput } from "$lib/components/inputs";
|
||||
import { refreshToken } from "$lib/hooks/callAPI";
|
||||
import { keyPairStore } from "$lib/stores";
|
||||
import { requestLogin } from "./service";
|
||||
|
||||
@@ -24,6 +26,13 @@
|
||||
// TODO: Alert
|
||||
}
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
const res = await refreshToken();
|
||||
if (res.ok) {
|
||||
await goto(data.redirectPath);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
||||
Reference in New Issue
Block a user