update axios-init and db.go

This commit is contained in:
Hamidreza Ghavami 2023-05-05 22:51:39 +04:30
parent 55c1fe26fb
commit 85c715a2f6
3 changed files with 21 additions and 5 deletions

View File

@ -1,6 +1,8 @@
package database
import (
"bytes"
"io"
"io/fs"
"os"
"path"
@ -104,3 +106,13 @@ func GetDB() *gorm.DB {
func IsNotFound(err error) bool {
return err == gorm.ErrRecordNotFound
}
func IsSQLiteDB(file io.Reader) (bool, error) {
signature := []byte("SQLite format 3\x00")
buf := make([]byte, len(signature))
_, err := file.Read(buf)
if err != nil {
return false, err
}
return bytes.Equal(buf, signature), nil
}

View File

@ -1,5 +1,5 @@
#app {
height: 100%;
height: 100vh;
}
.ant-space {

View File

@ -3,9 +3,13 @@ axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
axios.interceptors.request.use(
config => {
if (config.data instanceof FormData) {
config.headers['Content-Type'] = 'multipart/form-data';
} else {
config.data = Qs.stringify(config.data, {
arrayFormat: 'repeat'
arrayFormat: 'repeat',
});
}
return config;
},
error => Promise.reject(error)