diff options
| author | Hamidreza Ghavami <hamid.r.gh.1998@gmail.com> | 2023-05-05 21:21:39 +0300 |
|---|---|---|
| committer | Hamidreza Ghavami <hamid.r.gh.1998@gmail.com> | 2023-05-05 21:21:39 +0300 |
| commit | 85c715a2f610aad306e1ef9c3856f2264b01124e (patch) | |
| tree | a77176b220d35c96629b0c4b648639080a27cbd4 | |
| parent | 55c1fe26fba88210f0b24fcdeaf3cff6f779e741 (diff) | |
update axios-init and db.go
| -rw-r--r-- | database/db.go | 12 | ||||
| -rw-r--r-- | web/assets/css/custom.css | 2 | ||||
| -rw-r--r-- | web/assets/js/axios-init.js | 12 |
3 files changed, 21 insertions, 5 deletions
diff --git a/database/db.go b/database/db.go index ae42a6de..d5caa702 100644 --- a/database/db.go +++ b/database/db.go @@ -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 +} diff --git a/web/assets/css/custom.css b/web/assets/css/custom.css index d13e3159..671ba24f 100644 --- a/web/assets/css/custom.css +++ b/web/assets/css/custom.css @@ -1,5 +1,5 @@ #app { - height: 100%; + height: 100vh; } .ant-space { diff --git a/web/assets/js/axios-init.js b/web/assets/js/axios-init.js index 22d14d76..bd55c3cf 100644 --- a/web/assets/js/axios-init.js +++ b/web/assets/js/axios-init.js @@ -3,10 +3,14 @@ axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; axios.interceptors.request.use( config => { - config.data = Qs.stringify(config.data, { - arrayFormat: 'repeat' - }); + if (config.data instanceof FormData) { + config.headers['Content-Type'] = 'multipart/form-data'; + } else { + config.data = Qs.stringify(config.data, { + arrayFormat: 'repeat', + }); + } return config; }, error => Promise.reject(error) -);
\ No newline at end of file +); |
