test expose style
This commit is contained in:
parent
8f09e50172
commit
c9fd7baf9d
5 changed files with 25 additions and 13 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable, count } from 'rxjs';
|
import { Observable, count } from 'rxjs';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
|
|
@ -64,14 +64,16 @@ export class ToppingService {
|
||||||
let asyncCountry = await this._recipeService.getCurrentCountry();
|
let asyncCountry = await this._recipeService.getCurrentCountry();
|
||||||
country = getCountryMapSwitcher(asyncCountry);
|
country = getCountryMapSwitcher(asyncCountry);
|
||||||
|
|
||||||
|
let qParam = new HttpParams();
|
||||||
|
qParam = qParam.append('country', country);
|
||||||
|
qParam = qParam.append('filename', filename);
|
||||||
|
|
||||||
return this._httpClient.get<ToppingGroup[]>(
|
return this._httpClient.get<ToppingGroup[]>(
|
||||||
`${environment.api}/toppings/groups`,
|
`${environment.api}/toppover/groups`,
|
||||||
{
|
{
|
||||||
params: {
|
params: qParam,
|
||||||
country: country,
|
|
||||||
filename: filename,
|
|
||||||
},
|
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
|
responseType: 'json',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -84,14 +86,16 @@ export class ToppingService {
|
||||||
let asyncCountry = await this._recipeService.getCurrentCountry();
|
let asyncCountry = await this._recipeService.getCurrentCountry();
|
||||||
country = getCountryMapSwitcher(asyncCountry);
|
country = getCountryMapSwitcher(asyncCountry);
|
||||||
|
|
||||||
|
let qParam = new HttpParams();
|
||||||
|
qParam = qParam.append('country', country);
|
||||||
|
qParam = qParam.append('filename', filename);
|
||||||
|
|
||||||
return this._httpClient.get<ToppingList[]>(
|
return this._httpClient.get<ToppingList[]>(
|
||||||
`${environment.api}/toppings/lists`,
|
`${environment.api}/toppover/lists`,
|
||||||
{
|
{
|
||||||
params: {
|
params: qParam,
|
||||||
country: country,
|
|
||||||
filename: filename,
|
|
||||||
},
|
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
|
responseType: 'json',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: true,
|
production: true,
|
||||||
api: 'https://recipe.taobin.io:8090/api',
|
api: 'http://10.11.77.50:5555',
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"recipe-manager/config"
|
"recipe-manager/config"
|
||||||
|
|
@ -60,6 +61,9 @@ func (ar *AuthRouter) Route(r chi.Router) {
|
||||||
var redirectTo string
|
var redirectTo string
|
||||||
var kind string
|
var kind string
|
||||||
state := r.URL.Query().Get("state")
|
state := r.URL.Query().Get("state")
|
||||||
|
|
||||||
|
fmt.Println("url query", r.URL.Query())
|
||||||
|
|
||||||
if state == "" {
|
if state == "" {
|
||||||
http.Error(w, "State not found", http.StatusBadRequest)
|
http.Error(w, "State not found", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
|
|
@ -71,6 +75,8 @@ func (ar *AuthRouter) Route(r chi.Router) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("val", val)
|
||||||
|
|
||||||
redirectTo = val["redirect_to"]
|
redirectTo = val["redirect_to"]
|
||||||
kind = val["kind"]
|
kind = val["kind"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ func (tr *ToppingRouter) Route(r chi.Router) {
|
||||||
// check incoming request
|
// check incoming request
|
||||||
fmt.Println("topping router", r.Routes())
|
fmt.Println("topping router", r.Routes())
|
||||||
|
|
||||||
r.Route("/toppings", func(r chi.Router) {
|
r.Route("/toppover", func(r chi.Router) {
|
||||||
|
|
||||||
r.Get("/groups", tr.GetToppingGroups)
|
r.Get("/groups", tr.GetToppingGroups)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,8 @@ func (s *Server) createHandler() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// routers.NewToppingRouter(s.data, s.taoLogger).Route(r)
|
||||||
|
|
||||||
r.NotFound(func(w http.ResponseWriter, r *http.Request) {
|
r.NotFound(func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Add("Content-Type", "application/json")
|
w.Header().Add("Content-Type", "application/json")
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue