Skip to content

Commit

Permalink
names and care
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdsgl committed Nov 16, 2023
1 parent 7a88c64 commit 1a7e0ab
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class Table<T extends ColumnSchema> {
return this.props.app;
}

public get id(): string {
return this.props.table;
}

public get table(): string {
return this.props.table;
}
Expand All @@ -37,8 +41,8 @@ class Table<T extends ColumnSchema> {

constructor(props: TableProps<T>) {
this.props = {
token: process.env.GLIDE_TOKEN,
...props,
token: props.token ?? process.env.GLIDE_TOKEN,
};
this.client = makeClient({
token: process.env.GLIDE_TOKEN!,
Expand Down Expand Up @@ -201,7 +205,12 @@ class Table<T extends ColumnSchema> {
});

if (!response.ok) {
throw new Error(`Failed to get rows: ${response.status} ${response.statusText}`);
throw new Error(
`Failed to get rows: ${response.status} ${response.statusText} ${JSON.stringify({
app,
table,
})}`
);
}

const [result] = await response.json();
Expand All @@ -215,13 +224,19 @@ class Table<T extends ColumnSchema> {
}

class App {
private props: AppProps;
private client: Client;

public get id() {
return this.props.id;
}

public get name() {
return this.props.name;
}

constructor(private props: AppProps) {
constructor(props: AppProps) {
this.props = { ...props, token: props.token ?? process.env.GLIDE_TOKEN! };
this.client = makeClient({
token: process.env.GLIDE_TOKEN!,
});
Expand Down

0 comments on commit 1a7e0ab

Please sign in to comment.