Skip to content

Commit

Permalink
[feat] NS-15 oauth draft
Browse files Browse the repository at this point in the history
  • Loading branch information
Develsopher committed Mar 18, 2024
1 parent e955776 commit 102f74d
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 19 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ module.exports = {
callees: ['cn', 'cva'],
},
],
'tailwindcss/no-custom-classname': 'off',
},
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"path": "^0.12.7",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^5.0.1",
"react-router-dom": "^6.22.3",
"react-toastify": "^10.0.4",
"tailwind-merge": "^2.2.1",
Expand Down
51 changes: 33 additions & 18 deletions src/features/Splash/index.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
import { KakaoIcon } from '@/components/Icon';
import { Button } from '@/components/ui/button';
import SplashSun from '@/assets/splash-sun.png';
import SplashGirl from '@/assets/splash-girl2.png';
import { IoChatbubbleSharp } from 'react-icons/io5';

const SplashPage = () => {
const handleOauthLogin = (provider: string) => {
const googleLoginURL = `${import.meta.env.VITE_API_BASE_URL}/oauth2/authorization/${provider}`;
window.location.href = googleLoginURL;
};
const handleOauthLogin = (provider: string) => {
const oauthLoginUrl = `${import.meta.env.VITE_API_BASE_URL}/oauth2/authorization/${provider}`;
window.location.href = oauthLoginUrl;
};

const SplashPage = () => {
return (
<div className="flex h-dvh flex-col items-center ">
<Button
variant="kakao"
size="kakao"
<div className="h-dvh overflow-hidden bg-gradient-to-b from-blue-300 to-sky-400">
{/* <div className="absolute bottom-[-225px] left-[-52px] h-[631px] w-[272px] overflow-hidden bg-red-200">
<img src={SplashGirl} alt="splash-girl" />
</div> */}
<div className="absolute right-0 top-[13%] h-[631px] w-[272px] overflow-hidden bg-red-200 pl-[122px]">
<img
src={SplashGirl}
alt="splash-girl"
className="size-full object-contain"
/>
</div>
{/* <img
className="absolute right-0 top-[189.70px] h-60 w-40 origin-top-left rotate-[-46.01deg]"
src={SplashSun}
alt="splash-sun"
/> */}

<button
onClick={() => handleOauthLogin('kakao')}
className="absolute bottom-[72px] left-1/2 flex w-80 cursor-pointer items-center justify-between rounded-lg bg-yellow-400 px-4 py-3 transition-all hover:bg-yellow-300"
style={{ transform: 'translateX(-50%)' }}
>
<div className="h-[18px] w-[19.03px]">
<KakaoIcon />
<IoChatbubbleSharp className="size-5" />
<div className="text-center text-base font-medium leading-tight text-primary">
카카오 로그인
</div>

<p className="text-center text-[15px] font-medium leading-tight">
카카오로 로그인
</p>
</Button>
<div></div>
</button>
</div>
);
};
Expand Down
4 changes: 3 additions & 1 deletion src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import axios, { type AxiosInstance, type AxiosRequestConfig } from 'axios';
import { errorInterceptor } from './interceptors';

const axiosRequestConfig: AxiosRequestConfig = {
baseURL: import.meta.env.VITE_API_BASE_URL,
// baseURL: `${import.meta.env.VITE_API_END_POINT}/api`,
baseURL: `${import.meta.env.VITE_API_BASE_URL}`,
responseType: 'json',
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
},
withCredentials: true,
};

const api: AxiosInstance = axios.create(axiosRequestConfig);
Expand Down
1 change: 1 addition & 0 deletions src/services/api/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const getUserInfo = async () => {
return response;
}
} catch (error) {
console.log('error!!', error);
return null;
}
};
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4272,6 +4272,11 @@ react-dom@^18.2.0:
loose-envify "^1.1.0"
scheduler "^0.23.0"

react-icons@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-5.0.1.tgz#1694e11bfa2a2888cab47dcc30154ce90485feee"
integrity sha512-WqLZJ4bLzlhmsvme6iFdgO8gfZP17rfjYEJ2m9RsZjZ+cc4k1hTzknEz63YS1MeT50kVzoa1Nz36f4BEx+Wigw==

react-is@^18.2.0:
version "18.2.0"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
Expand Down

0 comments on commit 102f74d

Please sign in to comment.