로컬, 개발 실행설정 변경

This commit is contained in:
nevermoregb 2025-02-27 11:37:51 +09:00
parent bd91e0a72d
commit 4e75c988de
6 changed files with 122 additions and 107 deletions

View File

@ -1,6 +1,6 @@
VITE_DOMAIN = http://localhost:5173/
VITE_DOMAIN = https://192.168.0.251:5173/
# VITE_LOGIN_URL = http://localhost:10325/ms/
# VITE_FILE_URL = http://localhost:10325/ms/
# VITE_API_URL = http://localhost:10325/api/
VITE_API_URL = http://localhost:10325/test/
VITE_API_URL = https://192.168.0.251:10325/api/
VITE_TEST_URL = https://192.168.0.251:10325/test/
VITE_KAKAO_MAP_KEY=6f092e8f45ee81186bb6d8408f66a492

6
.env.mine Normal file
View File

@ -0,0 +1,6 @@
VITE_DOMAIN = http://localhost:5173/
# VITE_LOGIN_URL = http://localhost:10325/ms/
# VITE_FILE_URL = http://localhost:10325/ms/
VITE_API_URL = http://localhost:10325/api/
VITE_TEST_URL = http://localhost:10325/test/
VITE_KAKAO_MAP_KEY=6f092e8f45ee81186bb6d8408f66a492

View File

@ -1,50 +1,51 @@
{
"name": "front",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite --host 0.0.0.0 --mode dev",
"build": "vite build --mode prod",
"preview": "vite preview",
"lint": "eslint . --fix",
"format": "prettier --write src/"
},
"dependencies": {
"@fullcalendar/core": "^6.1.15",
"@fullcalendar/daygrid": "^6.1.15",
"@fullcalendar/interaction": "^6.1.15",
"@fullcalendar/vue3": "^6.1.15",
"@popperjs/core": "^2.11.8",
"@tinymce/tinymce-vue": "^5.1.1",
"@vueup/vue-quill": "^1.2.0",
"axios": "^1.7.9",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
"dayjs": "^1.11.13",
"dompurify": "^3.2.3",
"flatpickr": "^4.6.13",
"front": "file:",
"heic2any": "^0.0.4",
"pinia": "^2.2.6",
"pinia-plugin-persist": "^1.0.0",
"quill": "^2.0.3",
"upload-images-converter": "^2.0.2",
"vite-plugin-mkcert": "^1.17.6",
"vue": "^3.5.13",
"vue-flatpickr-component": "^11.0.5",
"vue-router": "^4.4.5",
"vue3-kakao-maps": "^2.3.10"
},
"devDependencies": {
"@eslint/js": "^9.14.0",
"@vitejs/plugin-vue": "^5.2.1",
"@vue/eslint-config-prettier": "^10.1.0",
"eslint": "^9.14.0",
"eslint-plugin-vue": "^9.30.0",
"prettier": "^3.3.3",
"vite": "^5.4.10",
"vite-plugin-inspect": "^0.8.9",
"vite-plugin-vue-devtools": "^7.6.5"
}
"name": "front",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite --host 0.0.0.0 --mode dev",
"mine": "vite --host 0.0.0.0 --mode mine",
"build": "vite build --mode prod",
"preview": "vite preview",
"lint": "eslint . --fix",
"format": "prettier --write src/"
},
"dependencies": {
"@fullcalendar/core": "^6.1.15",
"@fullcalendar/daygrid": "^6.1.15",
"@fullcalendar/interaction": "^6.1.15",
"@fullcalendar/vue3": "^6.1.15",
"@popperjs/core": "^2.11.8",
"@tinymce/tinymce-vue": "^5.1.1",
"@vueup/vue-quill": "^1.2.0",
"axios": "^1.7.9",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
"dayjs": "^1.11.13",
"dompurify": "^3.2.3",
"flatpickr": "^4.6.13",
"front": "file:",
"heic2any": "^0.0.4",
"pinia": "^2.2.6",
"pinia-plugin-persist": "^1.0.0",
"quill": "^2.0.3",
"upload-images-converter": "^2.0.2",
"vite-plugin-mkcert": "^1.17.6",
"vue": "^3.5.13",
"vue-flatpickr-component": "^11.0.5",
"vue-router": "^4.4.5",
"vue3-kakao-maps": "^2.3.10"
},
"devDependencies": {
"@eslint/js": "^9.14.0",
"@vitejs/plugin-vue": "^5.2.1",
"@vue/eslint-config-prettier": "^10.1.0",
"eslint": "^9.14.0",
"eslint-plugin-vue": "^9.30.0",
"prettier": "^3.3.3",
"vite": "^5.4.10",
"vite-plugin-inspect": "^0.8.9",
"vite-plugin-vue-devtools": "^7.6.5"
}
}

View File

@ -3,7 +3,7 @@ import { useRoute } from 'vue-router';
import { useToastStore } from '@s/toastStore';
const $api = axios.create({
baseURL: 'https://192.168.0.251:10325/api/',
baseURL: import.meta.env.VITE_API_URL,
timeout: 300000,
withCredentials: true,
});

View File

@ -8,9 +8,8 @@
<div class="navbar-nav-right d-flex align-items-center" id="navbar-collapse">
<ul class="navbar-nav flex-row align-items-center ms-auto">
<button class="btn p-1" @click="switchToLightMode"><i class='bx bxs-sun link-warning'></i></button>
<button class="btn p-1" @click="switchToDarkMode"><i class='bx bxs-moon' ></i></button>
<button class="btn p-1" @click="switchToLightMode"><i class="bx bxs-sun link-warning"></i></button>
<button class="btn p-1" @click="switchToDarkMode"><i class="bx bxs-moon"></i></button>
<i class="bx bx-bell bx-md bx-log-out cursor-pointer p-1" @click="handleLogout"></i>
@ -152,7 +151,13 @@
<!-- User -->
<li class="nav-item navbar-dropdown dropdown-user dropdown">
<a class="nav-link dropdown-toggle hide-arrow p-0" href="javascript:void(0);" data-bs-toggle="dropdown">
<img v-if="user" :src="`${baseUrl}upload/img/profile/${user.profile}`" alt="Profile Image" class="w-px-40 h-px-40 rounded-circle" @error="$event.target.src = '/img/icons/icon.png'"/>
<img
v-if="user"
:src="`${baseUrl}upload/img/profile/${user.profile}`"
alt="Profile Image"
class="w-px-40 h-px-40 rounded-circle"
@error="$event.target.src = '/img/icons/icon.png'"
/>
</a>
<ul class="dropdown-menu dropdown-menu-end">
<li>
@ -227,40 +232,37 @@
</nav>
</template>
<script setup>
import { useAuthStore } from '@s/useAuthStore';
import { useUserInfoStore } from '@/stores/useUserInfoStore';
import { useRouter } from 'vue-router';
import { useThemeStore } from '@s/darkmode';
import { onMounted, ref } from 'vue';
import $api from '@api';
import { useAuthStore } from '@s/useAuthStore';
import { useUserInfoStore } from '@/stores/useUserInfoStore';
import { useRouter } from 'vue-router';
import { useThemeStore } from '@s/darkmode';
import { onMounted, ref } from 'vue';
import $api from '@api';
const user = ref(null);
const baseUrl = $api.defaults.baseURL.replace(/api\/$/, '');
const user = ref(null);
//const baseUrl = $api.defaults.baseURL.replace(/api\/$/, '');
const baseUrl = import.meta.env.BASE_URL;
const authStore = useAuthStore();
const userStore = useUserInfoStore();
const router = useRouter();
const authStore = useAuthStore();
const userStore = useUserInfoStore();
const router = useRouter();
const { isDarkMode, switchToDarkMode, switchToLightMode } = useThemeStore();
const { isDarkMode, switchToDarkMode, switchToLightMode } = useThemeStore();
onMounted(async () => {
if (isDarkMode) {
switchToDarkMode();
} else {
switchToLightMode();
}
await userStore.userInfo();
user.value = userStore.user;
});
const handleLogout = async () => {
await authStore.logout();
router.push('/login');
};
onMounted(async () => {
if (isDarkMode) {
switchToDarkMode();
} else {
switchToLightMode();
}
await userStore.userInfo();
user.value = userStore.user;
});
const handleLogout = async () => {
await authStore.logout();
router.push('/login');
};
</script>
<style></style>

View File

@ -5,27 +5,33 @@ import vueDevTools from 'vite-plugin-vue-devtools';
import mkcert from 'vite-plugin-mkcert';
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
vueDevTools(),
// 자신의 로컬 서버에 연결하려면 이부분 주석처리
mkcert({
// SSL 키 등록
keyFile: '/localhost-key.pem',
certFile: '/localhost.pem',
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@a': fileURLToPath(new URL('./src/assets/', import.meta.url)),
'@c': fileURLToPath(new URL('./src/components/', import.meta.url)),
'@v': fileURLToPath(new URL('./src/views/', import.meta.url)),
'@l': fileURLToPath(new URL('./src/layout/', import.meta.url)),
'@s': fileURLToPath(new URL('./src/stores/', import.meta.url)),
'@p': fileURLToPath(new URL('./src/common/plugin/', import.meta.url)),
'@api': fileURLToPath(new URL('./src/common/axios-interceptor.js', import.meta.url)),
export default defineConfig(({ mode }) => {
const plugins = [vue(), vueDevTools()];
// dev: https, mine: http
if (mode === 'dev') {
plugins.push(
mkcert({
// SSL 키 등록
keyFile: '/localhost-key.pem',
certFile: '/localhost.pem',
}),
);
}
return {
plugins,
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@a': fileURLToPath(new URL('./src/assets/', import.meta.url)),
'@c': fileURLToPath(new URL('./src/components/', import.meta.url)),
'@v': fileURLToPath(new URL('./src/views/', import.meta.url)),
'@l': fileURLToPath(new URL('./src/layout/', import.meta.url)),
'@s': fileURLToPath(new URL('./src/stores/', import.meta.url)),
'@p': fileURLToPath(new URL('./src/common/plugin/', import.meta.url)),
'@api': fileURLToPath(new URL('./src/common/axios-interceptor.js', import.meta.url)),
},
},
},
};
});