🔧 properly use static/public
This commit is contained in:
parent
167022f587
commit
3719dcbaeb
@ -1,17 +1,21 @@
|
||||
<script lang="ts">
|
||||
import api from '$lib/api';
|
||||
import { tokenStore, userStore } from '../stores';
|
||||
|
||||
const INSTANCE_URL = 'http://localhost:4000';
|
||||
import { PUBLIC_INSTANCE_URL } from '$env/static/public';
|
||||
|
||||
let username = '';
|
||||
let password = '';
|
||||
|
||||
const onLogin = async () => {
|
||||
const app = await api.oauth.createApp(INSTANCE_URL);
|
||||
const result = await api.oauth.getTokenFromCredentials(INSTANCE_URL, app, username, password);
|
||||
const app = await api.oauth.createApp(PUBLIC_INSTANCE_URL);
|
||||
const result = await api.oauth.getTokenFromCredentials(
|
||||
PUBLIC_INSTANCE_URL,
|
||||
app,
|
||||
username,
|
||||
password
|
||||
);
|
||||
tokenStore.set(result.access_token);
|
||||
const user = await api.user.verifyCredentials(INSTANCE_URL, result.access_token);
|
||||
const user = await api.user.verifyCredentials(PUBLIC_INSTANCE_URL, result.access_token);
|
||||
console.log('user', user);
|
||||
userStore.set(user);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user