user 정보
This commit is contained in:
parent
81d68ea2f1
commit
32d68f198b
28
src/stores/useUserStore.js
Normal file
28
src/stores/useUserStore.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { ref } from 'vue';
|
||||||
|
import { defineStore } from 'pinia';
|
||||||
|
import $api from "@api";
|
||||||
|
|
||||||
|
export const useUserStore = defineStore('userInfo', () => {
|
||||||
|
const user = ref(null);
|
||||||
|
|
||||||
|
// 사용자 정보 가져오기
|
||||||
|
const userInfo = async () => {
|
||||||
|
try {
|
||||||
|
const response = await $api.get('user/userInfo');
|
||||||
|
if (response.data.status === "OK") {
|
||||||
|
user.value = response.data.data;
|
||||||
|
console.log(user.value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("사용자 정보 조회 실패:", error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
user,
|
||||||
|
userInfo,
|
||||||
|
};
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user