Skip to content

Commit

Permalink
fix: try fix cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
Horbin-Magician committed Apr 15, 2024
1 parent 746db62 commit 76c26a2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion back-end/www/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
else: app.config.from_object("www.settings.ProductionConfig")

app.register_blueprint(api, url_prefix='/api') # 注册蓝图api
cors = CORS(app, supports_credentials=True) # 允许跨域
cors = CORS(app, resources={r"/api/*": {"origins": "https://fluctus.cc"}}, supports_credentials=True) # 允许跨域
2 changes: 2 additions & 0 deletions front-end/src/api/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
import axios from 'axios'

axios.defaults.withCredentials = true;

export default function ajax(url, data = {}, type = 'GET') {
if(process.env.NODE_ENV == 'production') url = 'https://api.fluctus.cc' + url
return new Promise((resolve) => {
Expand Down
2 changes: 1 addition & 1 deletion front-end/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default defineConfig({
},
server: {
proxy: {
"/api": "https://api.fluctus.cc",
"/api": "http://localhost:5000",
},
},
})

0 comments on commit 76c26a2

Please sign in to comment.