Skip to content

Commit

Permalink
Updated Cors
Browse files Browse the repository at this point in the history
  • Loading branch information
mariinkys committed Nov 5, 2023
1 parent 3e43ec4 commit 9de9dcc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion delphinus-backend/cmd/api/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func SessionLoad(next http.Handler) http.Handler {
// CorsMiddleware handlers cors for the api
func CorsMiddleware(next http.Handler) http.Handler {
corsMiddleware := cors.New(cors.Options{
AllowedOrigins: []string{"http://localhost:5173"},
AllowedOrigins: []string{"http://localhost:5173", "https://delphinus.mariinkys.dev/", "http://delphinus.mariinkys.dev/", "104.248.241.221"},
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH", "DELETE"},
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token", "X-Requested-With", "Origin"},
AllowCredentials: true,
Expand Down
2 changes: 1 addition & 1 deletion delphinus-backend/cmd/api/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func routes(app *config.AppConfig) http.Handler {
mux.Use(middleware.Recoverer)
mux.Use(middleware.Logger) //TODO: Temporal Logger
mux.Use(SessionLoad)
mux.Use(CorsMiddleware)
//mux.Use(CorsMiddleware)

mux.Post("/searchdictionary", handlers.Repo.SearchDictionary)
mux.Post("/generateflashcards", handlers.Repo.GenerateFlashcards)
Expand Down
2 changes: 1 addition & 1 deletion delphinus-ui/src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ export default {
await fetch(url, {
method: "POST",
mode: "cors",
cache: "no-cache",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
credentials: 'include',
body: formData
})
.then(data => data.json())
Expand Down
2 changes: 1 addition & 1 deletion delphinus-ui/src/views/ResultsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export default {
await fetch(url, {
method: "POST",
mode: "cors",
cache: "no-cache",
headers: {
"Content-Type": "application/json"
},
credentials: 'omit',
body: JSON.stringify(this.flashcards)
})
.then(data => data.json())
Expand Down

0 comments on commit 9de9dcc

Please sign in to comment.