This commit is contained in:
3
.env
3
.env
@@ -1 +1,2 @@
|
|||||||
BASE_URL=https://chat.madsky.ru
|
VITE_API_URL=https://chat.madsky.ru
|
||||||
|
VITE_WS_URL=ws://localhost:3000
|
||||||
2
.env.production
Normal file
2
.env.production
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
VITE_API_URL=https://chat.madsky.ru
|
||||||
|
VITE_WS_URL=ws://localhost:3000
|
||||||
@@ -7,6 +7,9 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
const me = ref<User>()
|
const me = ref<User>()
|
||||||
|
|
||||||
async function login(email: string) {
|
async function login(email: string) {
|
||||||
|
const baseUrl = import.meta.env.VITE_API_URL
|
||||||
|
console.log(baseUrl)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {
|
const options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -15,7 +18,7 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({ email: email }),
|
body: JSON.stringify({ email: email }),
|
||||||
}
|
}
|
||||||
const res = await fetch('http://localhost:5173/api/login', options)
|
const res = await fetch(baseUrl + '/api/login', options)
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
const data: { accessToken: string; refreshToken: string } = await res.json()
|
const data: { accessToken: string; refreshToken: string } = await res.json()
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export enum COMMAND {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const useSocketsStore = defineStore('sockets', () => {
|
export const useSocketsStore = defineStore('sockets', () => {
|
||||||
const url = 'ws://localhost:3000/ws'
|
const url = import.meta.env.WS_URL + '/ws'
|
||||||
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const chatsStore = useChatsStore()
|
const chatsStore = useChatsStore()
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
host: true,
|
// host: true,
|
||||||
port: 5173,
|
port: 5173,
|
||||||
strictPort: true,
|
strictPort: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
|
|||||||
Reference in New Issue
Block a user