-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#35] feat : Add function which delete label
- Loading branch information
Showing
14 changed files
with
217 additions
and
43 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
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,37 @@ | ||
import React, { useEffect } from 'react'; | ||
import qs from 'qs'; | ||
import axios from 'axios'; | ||
import URL from '../../util/url'; | ||
import Main from '../main/Main'; | ||
import { RouteComponentProps } from 'react-router-dom'; | ||
|
||
interface Props extends RouteComponentProps {} | ||
|
||
const KakaoOauth: React.FC<Props> = ({ history, location }) => { | ||
useEffect(() => { | ||
const getToken = async () => { | ||
const { code } = qs.parse(location.search, { | ||
ignoreQueryPrefix: true, | ||
}); | ||
|
||
try { | ||
const response = await axios.get(`${URL}/login/kakao?code=${code}`); | ||
localStorage.setItem('token', response.data.data.jwt); | ||
|
||
axios.get(`${URL}/jwt`, { | ||
headers: { Authorization: 'Bearer ' + localStorage.getItem('token') }, | ||
}); | ||
history.push('/main'); | ||
} catch (error) { | ||
alert(error); | ||
history.push('/'); | ||
} | ||
}; | ||
|
||
getToken(); | ||
}, [location, history]); | ||
|
||
return <Main />; | ||
}; | ||
|
||
export default KakaoOauth; |
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
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,37 @@ | ||
import React, { useEffect } from 'react'; | ||
import qs from 'qs'; | ||
import axios from 'axios'; | ||
import URL from '../../util/url'; | ||
import Main from '../main/Main'; | ||
import { RouteComponentProps } from 'react-router-dom'; | ||
|
||
interface Props extends RouteComponentProps {} | ||
|
||
const NaverOauth: React.FC<Props> = ({ history, location }) => { | ||
useEffect(() => { | ||
const getToken = async () => { | ||
const { code } = qs.parse(location.search, { | ||
ignoreQueryPrefix: true, | ||
}); | ||
|
||
try { | ||
const response = await axios.get(`${URL}/login/naver?code=${code}`); | ||
localStorage.setItem('token', response.data.data.jwt); | ||
|
||
axios.get(`${URL}/jwt`, { | ||
headers: { Authorization: 'Bearer ' + localStorage.getItem('token') }, | ||
}); | ||
history.push('/main'); | ||
} catch (error) { | ||
alert(error); | ||
history.push('/'); | ||
} | ||
}; | ||
|
||
getToken(); | ||
}, [location, history]); | ||
|
||
return <Main />; | ||
}; | ||
|
||
export default NaverOauth; |
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
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
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
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
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
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.