forked from polka_billy/porridger
Removed builtin static video file
Switched from CORS to proxy for dev
This commit is contained in:
Binary file not shown.
@ -10,13 +10,10 @@ const useFetch = (url, params, initialData) => {
|
||||
.then(res => {
|
||||
if (!res.ok) {
|
||||
switch (res.status) {
|
||||
case 401: {
|
||||
case 401:
|
||||
throw new Error("Ошибка авторизации")
|
||||
}
|
||||
case 404: {
|
||||
new Error("Объект не найден")
|
||||
}
|
||||
break
|
||||
case 404:
|
||||
throw new Error("Объект не найден")
|
||||
default: {
|
||||
throw new Error("Ошибка ответа от сервера")
|
||||
}
|
||||
@ -32,6 +29,10 @@ const useFetch = (url, params, initialData) => {
|
||||
.catch(err => {
|
||||
setError("Ошибка сети")
|
||||
setLoading(false)
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
console.log(url, params, err)
|
||||
}
|
||||
})
|
||||
}, [url, params])
|
||||
|
||||
|
@ -1,10 +1,19 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
const BACK_ADDRESS = 'http://127.0.0.1:8000'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(
|
||||
({ command }) => ({
|
||||
base: (command === 'serve') ? "/" : "/static",
|
||||
plugins: [react()],
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': BACK_ADDRESS,
|
||||
'/static': BACK_ADDRESS,
|
||||
'/uploads': BACK_ADDRESS
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
Reference in New Issue
Block a user