kopia lustrzana https://github.com/bugout-dev/moonstream
Server sends /now responses with microseconds since epoch
Millisecond and microsecond is fractional part of float response. Also removed search.service.js from frontend codebase.pull/105/head
rodzic
769b28f728
commit
cc4dfa5ebf
|
@ -42,7 +42,7 @@ async def version_handler() -> data.VersionResponse:
|
|||
|
||||
@app.get("/now", tags=["time"])
|
||||
async def now_handler() -> int:
|
||||
return data.NowResponse(epoch_time=int(time.time()))
|
||||
return data.NowResponse(epoch_time=time.time())
|
||||
|
||||
|
||||
app.mount("/subscriptions", subscriptions_api)
|
||||
|
|
|
@ -57,7 +57,7 @@ class NowResponse(BaseModel):
|
|||
Schema for responses on /now endpoint
|
||||
"""
|
||||
|
||||
epoch_time: int
|
||||
epoch_time: float
|
||||
|
||||
|
||||
class SubscriptionUpdate(BaseModel):
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
import { BUGOUT_API_URL, BUGOUT_ENDPOINTS } from "../constants";
|
||||
|
||||
export const getResultsByEndpoint = async (query, endpoint, clientID) => {
|
||||
if (!BUGOUT_ENDPOINTS[endpoint]) {
|
||||
throw new Error(`Invalid Bugout endpoint: ${endpoint}`);
|
||||
}
|
||||
|
||||
let data;
|
||||
try {
|
||||
const requestURL = `${BUGOUT_API_URL}/${
|
||||
BUGOUT_ENDPOINTS[endpoint]
|
||||
}?q=${encodeURIComponent(query)}`;
|
||||
const method = "GET";
|
||||
const headers = {
|
||||
"x-simiotics-client-id": clientID,
|
||||
};
|
||||
|
||||
// TODO(neeraj): Configure search API to accept Authorization header. The way it is set up
|
||||
// now, the AWS Lambdas accept all origins for CORS purposes. This prevents us from setting
|
||||
// Authorization header since we need to set Access-Control-Allow-Authentication to true,
|
||||
// which requires us to restrict origins. On Lambda, since I am setting CORS headers
|
||||
// myself, I would have to implement the logic to handle multiple origins (since the
|
||||
// Access-Control-Allow-Origins only takes one origin).
|
||||
// At that point, uncomment the following:
|
||||
// const token = localStorage.getItem('MOONSTREAM_ACCESS_TOKEN')
|
||||
// if (token) {
|
||||
// headers.Authorization = `Bearer ${localStorage.getItem('MOONSTREAM_ACCESS_TOKEN')}`
|
||||
// }
|
||||
|
||||
const response = await fetch(requestURL, { method, headers });
|
||||
data = await response.json();
|
||||
|
||||
return {
|
||||
endpoint,
|
||||
data,
|
||||
};
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
throw new Error(`Error using Bugout Search API: ${err}`);
|
||||
}
|
||||
};
|
Ładowanie…
Reference in New Issue