Skip to content

Commit d80a1b7

Browse files
chore: folder rename example app (#25)
Because - folder rename example app This commit - folder rename example app
1 parent 79bdee8 commit d80a1b7

File tree

14 files changed

+124
-124
lines changed

14 files changed

+124
-124
lines changed

examples/my-app/src/pages/index.tsx

Lines changed: 0 additions & 124 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

examples/next-app/src/pages/index.tsx

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
// import { useEffect, useState } from "react";
2+
// import InstillClient, {
3+
// Nullable,
4+
// Pipeline,
5+
// User,
6+
// } from "@instill-ai/typescript-sdk";
7+
8+
// export default function TypescriptSdkDemo() {
9+
// const [pipelines, setPipelines] = useState<Pipeline[]>([]);
10+
// const [user, setUser] = useState<User[]>([]);
11+
// const [token, setToken] = useState<Nullable<string>>(null);
12+
13+
// const client = new InstillClient("http://localhost:8080", "v1alpha", token);
14+
15+
// const login = async () => {
16+
// const userToken = await client.Auth.authLoginAction({
17+
// payload: {
18+
// username: "admin",
19+
// password: "password",
20+
// },
21+
// });
22+
// setToken(userToken);
23+
// };
24+
25+
// useEffect(() => {
26+
// login();
27+
// }, []);
28+
29+
// useEffect(() => {
30+
// if (token) {
31+
// client.Auth.getUserQuery()
32+
// .then((data: any) => {
33+
// console.log("data", data);
34+
// setUser(data);
35+
// })
36+
// .catch((error: any) => {
37+
// console.log("error", error);
38+
// });
39+
40+
// client.Pipeline.listPipelinesQuery({
41+
// pageSize: null,
42+
// nextPageToken: null,
43+
// })
44+
// .then((data: any) => {
45+
// console.log("data", data);
46+
// setPipelines(data);
47+
// })
48+
// .catch((error: any) => {
49+
// console.log("error", error);
50+
// });
51+
// }
52+
// }, [token]);
53+
54+
// return (
55+
// <>
56+
// <h1>User Data</h1>
57+
// <pre style={{ backgroundColor: "white" }}>
58+
// {JSON.stringify(user, null, 4)}
59+
// </pre>
60+
61+
// <h1>Pipelines List</h1>
62+
// <pre style={{ backgroundColor: "white" }}>
63+
// {JSON.stringify(pipelines, null, 4)}
64+
// </pre>
65+
// </>
66+
// );
67+
// }
68+
69+
// Console Token Implementation
70+
71+
import { useEffect, useState } from "react";
72+
import InstillClient, {
73+
Nullable,
74+
Pipeline,
75+
User,
76+
} from "@instill-ai/typescript-sdk";
77+
78+
export default function TypescriptSdkDemo() {
79+
const [pipelines, setPipelines] = useState<Pipeline[]>([]);
80+
const [user, setUser] = useState<User[]>([]);
81+
82+
const client = new InstillClient(
83+
"https://api.instill.tech",
84+
"v1alpha",
85+
"instill_sk_OwuGQ8RGL6ObzYsneAG9Mib1k6zi9Gmj" // console API token
86+
);
87+
88+
useEffect(() => {
89+
client.Auth.getUserQuery()
90+
.then((data: any) => {
91+
console.log("data", data);
92+
setUser(data);
93+
})
94+
.catch((error: any) => {
95+
console.log("error", error);
96+
});
97+
98+
client.Pipeline.listPipelinesQuery({
99+
pageSize: null,
100+
nextPageToken: null,
101+
})
102+
.then((data: any) => {
103+
console.log("data", data);
104+
setPipelines(data);
105+
})
106+
.catch((error: any) => {
107+
console.log("error", error);
108+
});
109+
}, []);
110+
111+
return (
112+
<>
113+
<h1>User Data</h1>
114+
<pre style={{ backgroundColor: "white" }}>
115+
{JSON.stringify(user, null, 4)}
116+
</pre>
117+
118+
<h1>Pipelines List</h1>
119+
<pre style={{ backgroundColor: "white" }}>
120+
{JSON.stringify(pipelines, null, 4)}
121+
</pre>
122+
</>
123+
);
124+
}
File renamed without changes.

0 commit comments

Comments
 (0)