mirror of
https://github.com/ivabus/gui
synced 2025-06-07 15:50:27 +03:00
#78 cleanup localhost -> api.tea.xyz
This commit is contained in:
parent
721c278fd4
commit
6ab764177d
3 changed files with 7 additions and 4 deletions
|
@ -2,12 +2,13 @@
|
||||||
import { open } from '@tauri-apps/api/shell';
|
import { open } from '@tauri-apps/api/shell';
|
||||||
import { authStore } from '$libs/stores';
|
import { authStore } from '$libs/stores';
|
||||||
import type { Developer } from '@tea/ui/types';
|
import type { Developer } from '@tea/ui/types';
|
||||||
|
import { apiBaseUrl } from '@api';
|
||||||
|
|
||||||
let user: Developer | null = null;
|
let user: Developer | null = null;
|
||||||
const deviceId = authStore.deviceIdStore;
|
const deviceId = authStore.deviceIdStore;
|
||||||
|
|
||||||
const openGithub = () => {
|
const openGithub = () => {
|
||||||
open(`http://localhost:3000/v1/auth/user?device_id=${$deviceId}`);
|
open(`${apiBaseUrl}/auth/user?device_id=${$deviceId}`);
|
||||||
try {
|
try {
|
||||||
authStore.pollSession();
|
authStore.pollSession();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -11,6 +11,8 @@ import { PackageStates } from '../types';
|
||||||
import { loremIpsum } from 'lorem-ipsum';
|
import { loremIpsum } from 'lorem-ipsum';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
export const apiBaseUrl = 'https://api.tea.xyz/v1';
|
||||||
|
|
||||||
const packages: Package[] = [
|
const packages: Package[] = [
|
||||||
{
|
{
|
||||||
slug: 'mesonbuild_com',
|
slug: 'mesonbuild_com',
|
||||||
|
|
|
@ -21,13 +21,13 @@ import type { GUIPackage, Course, Category, AuthStatus } from '../types';
|
||||||
import * as mock from './mock';
|
import * as mock from './mock';
|
||||||
import { PackageStates } from '../types';
|
import { PackageStates } from '../types';
|
||||||
|
|
||||||
// const base = 'https://api.tea.xyz/v1';
|
export const apiBaseUrl = 'https://api.tea.xyz/v1';
|
||||||
const base = 'http://localhost:3000/v1';
|
// const apiBaseUrl = 'http://localhost:3000/v1';
|
||||||
|
|
||||||
async function get<T>(path: string, query?: { [key: string]: string }) {
|
async function get<T>(path: string, query?: { [key: string]: string }) {
|
||||||
console.log('path', path);
|
console.log('path', path);
|
||||||
const client = await getClient();
|
const client = await getClient();
|
||||||
const uri = join(base, path);
|
const uri = join(apiBaseUrl, path);
|
||||||
console.log('uri:', uri);
|
console.log('uri:', uri);
|
||||||
const { data } = await client.get<T>(uri.toString(), {
|
const { data } = await client.get<T>(uri.toString(), {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
Loading…
Reference in a new issue