Env swap #21
@ -12,6 +12,7 @@ open Giraffe.EndpointRouting
|
||||
/// Configure the ASP.NET Core pipeline to use Giraffe
|
||||
let configureApp (app : IApplicationBuilder) =
|
||||
app
|
||||
.UseCors(fun p -> p.AllowAnyOrigin() |> ignore)
|
||||
.UseRouting()
|
||||
.UseEndpoints(fun e -> e.MapGiraffeEndpoints Handlers.allEndpoints)
|
||||
|> ignore
|
||||
@ -25,6 +26,7 @@ let configureServices (svc : IServiceCollection) =
|
||||
svc.AddGiraffe () |> ignore
|
||||
svc.AddSingleton<IClock> SystemClock.Instance |> ignore
|
||||
svc.AddLogging () |> ignore
|
||||
svc.AddCors () |> ignore
|
||||
let svcs = svc.BuildServiceProvider()
|
||||
let cfg = svcs.GetRequiredService<IConfiguration>().GetSection "Rethink"
|
||||
let log = svcs.GetRequiredService<ILoggerFactory>().CreateLogger (nameof Data.Startup)
|
||||
|
@ -5,7 +5,7 @@ import { LogOnSuccess } from './types'
|
||||
* @param url The partial URL for the API
|
||||
* @returns A full URL for the API
|
||||
*/
|
||||
const apiUrl = (url : string) : string => `/api/${url}`
|
||||
const apiUrl = (url : string) : string => `http://localhost:5000/api/${url}`
|
||||
|
||||
export default {
|
||||
|
||||
@ -15,10 +15,9 @@ export default {
|
||||
* @returns The user result, or an error
|
||||
*/
|
||||
logOn: async (code : string) : Promise<LogOnSuccess | string> => {
|
||||
const resp = await fetch(apiUrl(`/citizen/log-on/${code}`), { method: 'GET' })
|
||||
const resp = await fetch(apiUrl(`citizen/log-on/${code}`), { method: 'GET', mode: 'cors' })
|
||||
if (resp.status === 200) return await resp.json() as LogOnSuccess
|
||||
console.error(await resp.text())
|
||||
return 'Error logging on'
|
||||
return `Error logging on - ${await resp.text()}`
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user