This commit is contained in:
yoon 2025-02-04 14:22:49 +09:00
parent e038c84baf
commit 9ee69e6730

View File

@ -1,6 +1,13 @@
/*
작성자 : 박지윤
작성일 : 2025-02-04
수정자 :
수정일 :
설명 : 로그인 상태, 로그아웃
*/
import { ref, computed } from 'vue';
import { defineStore } from 'pinia';
import axios from "@api";
import $api from "@api";
export const useAuthStore = defineStore('auth', () => {
const user = ref(null);
@ -10,7 +17,7 @@ export const useAuthStore = defineStore('auth', () => {
// 로그인 상태 확인
const checkAuthStatus = async () => {
const response = await axios.get('user/isLogin');
const response = await $api.get('user/isLogin');
if (response.data.status === "OK" && response.data.data) {
user.value = response.data.data;
} else {
@ -21,7 +28,7 @@ export const useAuthStore = defineStore('auth', () => {
// 로그아웃
const logout = async () => {
const response = await axios.get('user/logout');
const response = await $api.get('user/logout');
// 로그아웃 성공 시 사용자 상태 초기화
if (response.data.status === "OK") {