#78 cleanup localhost -> api.tea.xyz

This commit is contained in:
neil 2023-01-07 15:27:16 +08:00
parent 721c278fd4
commit 6ab764177d
3 changed files with 7 additions and 4 deletions

View file

@ -2,12 +2,13 @@
import { open } from '@tauri-apps/api/shell';
import { authStore } from '$libs/stores';
import type { Developer } from '@tea/ui/types';
import { apiBaseUrl } from '@api';
let user: Developer | null = null;
const deviceId = authStore.deviceIdStore;
const openGithub = () => {
open(`http://localhost:3000/v1/auth/user?device_id=${$deviceId}`);
open(`${apiBaseUrl}/auth/user?device_id=${$deviceId}`);
try {
authStore.pollSession();
} catch (error) {

View file

@ -11,6 +11,8 @@ import { PackageStates } from '../types';
import { loremIpsum } from 'lorem-ipsum';
import _ from 'lodash';
export const apiBaseUrl = 'https://api.tea.xyz/v1';
const packages: Package[] = [
{
slug: 'mesonbuild_com',

View file

@ -21,13 +21,13 @@ 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';
export const apiBaseUrl = 'https://api.tea.xyz/v1';
// const apiBaseUrl = 'http://localhost:3000/v1';
async function get<T>(path: string, query?: { [key: string]: string }) {
console.log('path', path);
const client = await getClient();
const uri = join(base, path);
const uri = join(apiBaseUrl, path);
console.log('uri:', uri);
const { data } = await client.get<T>(uri.toString(), {
headers: {