Skip to content

Commit

Permalink
fix(landing): correct client api url
Browse files Browse the repository at this point in the history
  • Loading branch information
Satont committed May 2, 2024
1 parent 1012db6 commit f0c5e02
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions frontend/landing/src/api/twirp-browser.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { TwirpFetchTransport } from '@protobuf-ts/twirp-transport';
import { ProtectedClient, UnProtectedClient } from '@twir/api/api.client';
import { TwirpFetchTransport } from '@protobuf-ts/twirp-transport'
import { ProtectedClient, UnProtectedClient } from '@twir/api/api.client'

const transport = new TwirpFetchTransport({
baseUrl: `${location.origin}/api/v1`,
});
baseUrl: `${location.origin}/api-old/v1`
})

export const browserUnProtectedClient = new UnProtectedClient(transport);
export const browserProtectedClient = new ProtectedClient(transport);
export const browserUnProtectedClient = new UnProtectedClient(transport)
export const browserProtectedClient = new ProtectedClient(transport)
36 changes: 18 additions & 18 deletions frontend/landing/src/components/login/login.vue
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<script lang="ts" setup>
import { ref, onMounted } from 'vue';
import { onMounted, ref } from 'vue'
import { browserUnProtectedClient } from '@/api/twirp-browser.js';
import UiButton from '@/components/ui/ui-button.vue';
import { browserUnProtectedClient } from '@/api/twirp-browser.js'
import UiButton from '@/components/ui/ui-button.vue'
const url = new URL(window.location.href);
const code = url.searchParams.get('code');
const state = url.searchParams.get('state');
const error = ref(url.searchParams.get('error'));
const loading = ref(true);
const url = new URL(window.location.href)
const code = url.searchParams.get('code')
const state = url.searchParams.get('state')
const error = ref(url.searchParams.get('error'))
const loading = ref(true)
onMounted(async () => {
if (error.value) {
return;
return
}
if (!code || !state) {
error.value = `Something unexpected happened, because authorization code wasn't provided. Please try to log in again`;
return;
error.value = `Something unexpected happened, because authorization code wasn't provided. Please try to log in again`
return
}
try {
const req = await browserUnProtectedClient.authPostCode({
code,
state,
});
state
})
window.location.replace(req.response.redirectTo);
window.location.replace(req.response.redirectTo)
} catch (requestError) {
console.error(requestError);
error.value = 'Internal error happened, please contact devs in discord';
console.error(requestError)
error.value = 'Internal error happened, please contact devs in discord'
} finally {
loading.value = false;
loading.value = false
}
});
})
</script>

<template>
Expand Down

0 comments on commit f0c5e02

Please sign in to comment.