Skip to content

Commit

Permalink
Merge branch 'feat/#113/oauth-kakao' of https://github.com/Team-Blitz…
Browse files Browse the repository at this point in the history
…-Steady/steady-client into feat/#113/oauth-kakao
  • Loading branch information
sscoderati committed Nov 6, 2023
2 parents 69e299f + 9c71797 commit fa687cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 7 additions & 5 deletions src/services/oauth/kakao/getKakaoLoginURL.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import axios from "axios";

const getKakaoLoginUrl = async () => {
try {
const res = await fetch("https://dev.steadies.kr/api/v1/auth/kakao", {
method: "GET",
});
if (!res.ok) {
const response = await axios.get(
"https://dev.steadies.kr/api/v1/auth/kakao",
);
if (response.status !== 200) {
throw new Error("Failed to fetch kakao url!");
}
return res.headers.get("Location");
return response.headers.location;
} catch (error) {
console.error(error);
}
Expand Down
8 changes: 5 additions & 3 deletions src/services/oauth/kakao/getKakaoToken.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import axios from "axios";

const getKakaoToken = async (code: string) => {
try {
const res = await fetch(
const response = await axios.get(
`https://dev.steadies.kr/api/v1/auth/kakao/callback?code=${code}`,
);
if (!res.ok) {
if (response.status !== 200) {
throw new Error("Failed to fetch kakao token!");
}
return res.json();
return response.data;
} catch (error) {
// TODO: error handling 로직 추가하기
console.error(error);
Expand Down

0 comments on commit fa687cc

Please sign in to comment.