Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pilot
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
조 지현
pilot
Commits
ab6fcfb4
Commit
ab6fcfb4
authored
1 year ago
by
조 지현
Browse files
Options
Downloads
Patches
Plain Diff
logout 분리
parent
dea857f9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/auth/Login.vue
+4
-10
4 additions, 10 deletions
src/components/auth/Login.vue
src/store/logout.js
+14
-12
14 additions, 12 deletions
src/store/logout.js
with
18 additions
and
22 deletions
src/components/auth/Login.vue
+
4
−
10
View file @
ab6fcfb4
...
...
@@ -2,6 +2,7 @@
import
axios
from
"
axios
"
;
import
CryptoJS
from
"
crypto-js
"
;
import
fetchData
from
"
@/store/fetchData
"
;
import
logout
from
"
@/store/logout.js
"
;
export
default
{
...
...
@@ -52,24 +53,17 @@ export default {
}
},
async
logout
()
{
// await logout.logout();
// fetch 해서 login 정보의 access 토큰을 들고와서 : 나중에 fetchData 분리 처리
const
response
=
await
axios
.
get
(
"
https://172.16.0.60:8443/api/auth/logout
"
,
{
headers
:
{
// accessToken 을 들고온 값을 여기 넣어주고
"
Authorization
"
:
`Bearer
${
this
.
$store
.
state
.
user
.
info
.
accessToken
}
`
,
},
async
logout
()
{
const
response
=
await
logout
.
logout
();
})
console
.
log
(
response
)
// 로그인 상태일때 "로그아웃" 실행
if
(
response
.
status
===
200
){
// user 값을 빈객체 null 혹은 {} 로 clear 해주기
this
.
$store
.
commit
(
"
setUserData
"
,
{});
console
.
log
(
"
로그아웃
"
)
console
.
log
(
"
로그아웃
성공
"
)
}
else
{
console
.
log
(
"
로그아웃 실패
"
)
}
...
...
This diff is collapsed.
Click to expand it.
src/store/logout.js
+
14
−
12
View file @
ab6fcfb4
import
axios
from
"
axios
"
;
import
store
from
"
@/store/store.js
"
;
// 로그인되어있는 상태에서 accessToken 값을 뽑아와서 header 에 실어보내 매칭시키고 clear 로
export
default
{
async
logout
()
{
// fetch 해서 login 정보의 access 토큰을 들고와서 : 나중에 fetchData 분리 처리
const
response
=
await
axios
.
get
(
"
https://172.16.0.60:8443/api/auth/logout
"
,
{
return
await
axios
.
get
(
"
https://172.16.0.60:8443/api/auth/logout
"
,
{
headers
:
{
// accessToken 을 들고온 값을 여기 넣어주고
"
Authorization
"
:
`Bearer
${
this
.
$store
.
state
.
user
.
info
.
accessToken
}
`
,
// this.$store 가 인식되지 않아 state 오류가 났고 store 를 import 해주었다.
"
Authorization
"
:
`Bearer
${
store
.
state
.
user
.
info
.
accessToken
}
`
,
},
})
console
.
log
(
response
)
// 로그인 상태일때 "로그아웃" 실행
if
(
response
.
status
===
200
){
// user 값을 빈객체 null 혹은 {} 로 clear 해주기
this
.
$store
.
commit
(
"
setUserData
"
,
{});
console
.
log
(
"
로그아웃
"
)
}
else
{
console
.
log
(
"
로그아웃 실패
"
)
}
//
console.log(response)
//
//
//
로그인 상태일때 "로그아웃" 실행
//
if(response.status === 200){
//
// user 값을 빈객체 null 혹은 {} 로 clear 해주기
//
this.$store.commit("setUserData", {});
//
console.log("로그아웃
성공
")
//
}else{
//
console.log("로그아웃 실패")
//
}
},
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment