Skip to content

Commit

Permalink
workaround for modal app being on different domain than github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
xiankai committed Aug 13, 2023
1 parent aa5f395 commit 2e8e4e5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/datasources/txtai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
import { uniqueId } from "lodash";
import { VITE_TXTAI_URL } from "../constants";
import { DefaultService, DocumentDataFull, OpenAPI } from "./txtai/generated";
import Cookies from "js-cookie";

interface TxtaiDocument {
id: string;
Expand Down Expand Up @@ -108,14 +109,17 @@ export default class TxtaiDatasource implements AsyncBaseDatasource {
source_metadata: message[ChatLogFormatSourceMetadata],
})),
},
firebaseToken: Cookies.get("firebase_token"),
})
.then(() => (finished = messages.length))
.catch((err) => (finished = JSON.stringify(err)));
return () => finished;
}

async retrieveBucketListFromStorage(): Promise<Recipient[]> {
return DefaultService.recipientsRecipientsGet({});
return DefaultService.recipientsRecipientsGet({
firebaseToken: Cookies.get("firebase_token"),
});
}

async retrieveBucketFromStorage(
Expand All @@ -127,6 +131,7 @@ export default class TxtaiDatasource implements AsyncBaseDatasource {
date: parseDateBucketIntoDateString(date),
recipient,
source,
firebaseToken: Cookies.get("firebase_token"),
});

return response.map(this.formatTxtaiResponse);
Expand All @@ -139,6 +144,7 @@ export default class TxtaiDatasource implements AsyncBaseDatasource {
const response = await DefaultService.dayFirstDayGet({
recipient,
source,
firebaseToken: Cookies.get("firebase_token"),
});

return response.map(this.formatTxtaiResponse);
Expand All @@ -151,6 +157,7 @@ export default class TxtaiDatasource implements AsyncBaseDatasource {
const response = await DefaultService.dayLastDayGet({
recipient,
source,
firebaseToken: Cookies.get("firebase_token"),
});

return response.map(this.formatTxtaiResponse);
Expand All @@ -163,6 +170,7 @@ export default class TxtaiDatasource implements AsyncBaseDatasource {
const response = await DefaultService.deleteDeleteDelete({
recipient,
source,
firebaseToken: Cookies.get("firebase_token"),
});
}

Expand All @@ -178,6 +186,7 @@ export default class TxtaiDatasource implements AsyncBaseDatasource {
async searchStorage(query: SearchQuery): Promise<ChatLogFormat[]> {
const response = await DefaultService.searchSearchGet({
q: query,
firebaseToken: Cookies.get("firebase_token"),
});

return response.map(this.formatTxtaiResponse);
Expand Down

0 comments on commit 2e8e4e5

Please sign in to comment.