Skip to content

Commit

Permalink
Remove axios
Browse files Browse the repository at this point in the history
  • Loading branch information
ptessier committed Jan 8, 2024
1 parent 4749b0a commit eb016c6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
19 changes: 12 additions & 7 deletions packages/sdk/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { getQueryStringVariation } from ".";
import { IAssignmentEvent, IAssignmentLogger } from "./assignment/assignment-logger";
import { IAssignment, IAssignmentPositive } from "./assignment/assignment-result";
import { getAssignedIndex, getBucketRanges } from "./assignment/bucket";
import { getHash } from "./assignment/hashing";
import { IExperimentDefinition } from "./dto/experiment-definition";
import { IStore } from "./store/store";
import {
IAssignment,
IAssignmentEvent,
IAssignmentLogger,
IAssignmentPositive,
getAssignedIndex,
getBucketRanges,
getHash,
getQueryStringVariation,
} from "./assignment";
import { IExperimentDefinition } from "./dto";
import { IStore } from "./store";
import { stringify } from "./utils";

declare global {
Expand Down
2 changes: 0 additions & 2 deletions packages/sdk/src/dto/experiment-definition.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export type IExperimentDefinitions = Record<string, IExperimentDefinition>;

export interface IExperimentDefinition {
/**
* Unique identifier for the experiment
Expand Down
13 changes: 7 additions & 6 deletions packages/sdk/src/init.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import axios from "axios";
import { IAssignmentLogger } from "./assignment/assignment-logger";
import { IAssignmentLogger } from "./assignment";
import { Client } from "./client";
import { InMemoryStore } from "./store/in-memory-store";
import { IStore } from "./store/store";
import { IExperimentDefinition } from "./dto";
import { IStore, InMemoryStore } from "./store";

export interface ISdkConfig {
/**
Expand Down Expand Up @@ -51,7 +50,9 @@ export async function init(config: ISdkConfig) {
}

async function fetchExperiments(url: string) {
const response = await axios.get(url);
const response = await fetch(url);

return response.data;
const data = await response.json();

return data as Record<string, IExperimentDefinition>;
}
2 changes: 1 addition & 1 deletion packages/sdk/src/store/in-memory-store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IExperimentDefinition } from "../dto/experiment-definition";
import { IExperimentDefinition } from "../dto";
import { InMemoryCache } from "./in-memory-cache";
import { IStore } from "./store";

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/store/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IExperimentDefinition } from "../dto/experiment-definition";
import { IExperimentDefinition } from "../dto";
import { ICache } from "./cache";

export interface IStore {
Expand Down

0 comments on commit eb016c6

Please sign in to comment.