-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat] 어드민 API 연동
- Loading branch information
Showing
34 changed files
with
799 additions
and
515 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { PostImageResponse } from "@/types/imageApi"; | ||
import "@/types/lotteryApi"; | ||
import { fetchWithTimeout } from "@/utils/fetchWithTimeout"; | ||
|
||
const baseURL = `${import.meta.env.VITE_API_URL}/admin/image`; | ||
|
||
export const ImageAPI = { | ||
async postImage(image: FormData, token: string): Promise<PostImageResponse> { | ||
try { | ||
const response = await fetchWithTimeout(`${baseURL}`, { | ||
method: "POST", | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
body: image, | ||
}); | ||
|
||
return response.json(); | ||
} catch (error) { | ||
console.error("Error:", error); | ||
throw error; | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.