mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-15 22:38:47 +00:00
로그인 구현
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from "svelte";
|
||||
|
||||
interface Props {
|
||||
children?: any;
|
||||
children: Snippet;
|
||||
color?: "primary" | "gray";
|
||||
onclick?: () => void;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from "svelte";
|
||||
interface Props {
|
||||
children?: any;
|
||||
children: Snippet;
|
||||
onclick?: () => void;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,13 +35,13 @@ const callAPIInternal = async (
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
if (res.status === 401 && retryIfUnauthorized) {
|
||||
if (res.status === 401 && retryIfUnauthorized && token !== undefined) {
|
||||
return await callAPIInternal(input, init, null, false);
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
export const callAPI = async (input: RequestInfo, init?: RequestInit, token?: string | null) => {
|
||||
export default async (input: RequestInfo, init?: RequestInit, token?: string | null) => {
|
||||
return await callAPIInternal(input, init, token);
|
||||
};
|
||||
|
||||
1
src/lib/hooks/index.ts
Normal file
1
src/lib/hooks/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default as callAPI } from "./callAPI";
|
||||
Reference in New Issue
Block a user