diff --git a/packages/gui/src-tauri/tauri.conf.json b/packages/gui/src-tauri/tauri.conf.json
index 9b417d5..ddbbd56 100644
--- a/packages/gui/src-tauri/tauri.conf.json
+++ b/packages/gui/src-tauri/tauri.conf.json
@@ -15,7 +15,7 @@
"http": {
"all": true,
"request": true,
- "scope": ["https://api.tea.xyz/v1/*", "https://github.com/*"]
+ "scope": ["https://api.tea.xyz/v1/*", "https://github.com/*", "http://localhost:3000/v1/*"]
},
"shell": {
"all": true,
diff --git a/packages/gui/src/components/Auth/Auth.svelte b/packages/gui/src/components/Auth/Auth.svelte
new file mode 100644
index 0000000..b26f89d
--- /dev/null
+++ b/packages/gui/src/components/Auth/Auth.svelte
@@ -0,0 +1,46 @@
+
+
+
{loop}:{statusMessage}
+
\ No newline at end of file
diff --git a/packages/gui/src/libs/api/mock.ts b/packages/gui/src/libs/api/mock.ts
index ac91c9e..f15f08d 100644
--- a/packages/gui/src/libs/api/mock.ts
+++ b/packages/gui/src/libs/api/mock.ts
@@ -322,3 +322,12 @@ export async function getCategorizedPackages(): Promise {
}
];
}
+
+export async function getDeviceAuth(): Promise {
+ const deviceId = 'xyz123';
+ // const data = await get(`/auth/device/${deviceId}`);
+ return {
+ status: 'SUCCESS',
+ user: {},
+ };
+}
\ No newline at end of file
diff --git a/packages/gui/src/libs/api/tauri.ts b/packages/gui/src/libs/api/tauri.ts
index 3747ae1..163652e 100644
--- a/packages/gui/src/libs/api/tauri.ts
+++ b/packages/gui/src/libs/api/tauri.ts
@@ -14,16 +14,19 @@ import { getClient } from '@tauri-apps/api/http';
// import { invoke } from '@tauri-apps/api';
import { Command } from '@tauri-apps/api/shell';
import { readDir, BaseDirectory } from '@tauri-apps/api/fs';
-import type { Package, Review, AirtablePost } from '@tea/ui/types';
-import type { GUIPackage, Course, Category } from '../types';
+import type { Package, Review, AirtablePost, User } from '@tea/ui/types';
+import type { GUIPackage, Course, Category, AuthStatus } from '../types';
import * as mock from './mock';
import { PackageStates } from '../types';
const base = 'https://api.tea.xyz/v1';
+// const base = 'http://localhost:3000/v1';
async function get(path: string, query?: { [key: string]: string }) {
+ console.log('path', path);
const client = await getClient();
const uri = join(base, path);
+ console.log('uri:', uri);
const { data } = await client.get(uri.toString(), {
headers: {
Authorization: 'public' // TODO: figure out why req w/o Authorization does not work
@@ -161,3 +164,14 @@ export async function getCategorizedPackages(): Promise {
const categories = await get('/packages/categorized');
return categories;
}
+
+type DeviceAuth = {
+ status: AuthStatus;
+ user: User;
+}
+
+export async function getDeviceAuth(): Promise {
+ const deviceId = 'xyxz123';
+ const data = await get(`/auth/device/${deviceId}`);
+ return data;
+}
\ No newline at end of file
diff --git a/packages/gui/src/libs/types.ts b/packages/gui/src/libs/types.ts
index b4617f4..8a8c272 100644
--- a/packages/gui/src/libs/types.ts
+++ b/packages/gui/src/libs/types.ts
@@ -29,3 +29,10 @@ export type Category = {
cta_label: string;
packages: GUIPackage[];
};
+
+export enum AuthStatus {
+ UNKNOWN = 'UNKNOWN',
+ PENDING = 'PENDING',
+ SUCCESS = 'SUCCESS',
+ FAILED = 'FAILED',
+}
diff --git a/packages/gui/src/routes/+page.svelte b/packages/gui/src/routes/+page.svelte
index 091d638..4fec90d 100644
--- a/packages/gui/src/routes/+page.svelte
+++ b/packages/gui/src/routes/+page.svelte
@@ -9,6 +9,7 @@
import News from '$components/News/News.svelte';
import CategorizedPackages from '$components/CategorizedPackages/CategorizedPackages.svelte';
backLink.set('');
+ console.log("test", window.location)
diff --git a/packages/gui/src/routes/profile/+page.svelte b/packages/gui/src/routes/profile/+page.svelte
index 21855de..fd6c7ca 100644
--- a/packages/gui/src/routes/profile/+page.svelte
+++ b/packages/gui/src/routes/profile/+page.svelte
@@ -6,12 +6,15 @@
import Badges from '$components/Badges/Badges.svelte';
import InstalledPackages from '$components/InstalledPackages/InstalledPackages.svelte';
import { backLink } from '$libs/stores';
+ import Auth from '$components/Auth/Auth.svelte';
backLink.set('/');
PROFILE
-
+
diff --git a/packages/ui/src/types.ts b/packages/ui/src/types.ts
index ca1dac3..eac3436 100644
--- a/packages/ui/src/types.ts
+++ b/packages/ui/src/types.ts
@@ -34,3 +34,9 @@ export type AirtablePost = {
published_at: Date;
tags: string[];
};
+
+export type User = {
+ username: string;
+ country?: string;
+ eth_wallet_address?: string;
+}
\ No newline at end of file