👽 Update API path
This commit is contained in:
@@ -61,7 +61,7 @@ function handleSuccess(token: string) {
|
|||||||
// This function will be used to fetch configuration if needed,
|
// This function will be used to fetch configuration if needed,
|
||||||
// Like the backend didn't embed the configuration properly.
|
// Like the backend didn't embed the configuration properly.
|
||||||
async function fetchConfiguration() {
|
async function fetchConfiguration() {
|
||||||
const resp = await api<{ provider: string; apiKey: string }>("/id/captcha")
|
const resp = await api<{ provider: string; apiKey: string }>("/pass/captcha")
|
||||||
provider.value = resp.provider
|
provider.value = resp.provider
|
||||||
apiKey.value = resp.apiKey
|
apiKey.value = resp.apiKey
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ const apiBaseServer = useSolarNetworkUrl()
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const { data, error } = await useFetch<SnAccount>(
|
const { data, error } = await useFetch<SnAccount>(
|
||||||
`${apiBaseServer}/id/accounts/${username.value}`,
|
`${apiBaseServer}/pass/accounts/${username.value}`,
|
||||||
{ server: true }
|
{ server: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ const requestedScopes = computed(() => {
|
|||||||
async function fetchClientInfo() {
|
async function fetchClientInfo() {
|
||||||
try {
|
try {
|
||||||
const queryString = window.location.search.slice(1)
|
const queryString = window.location.search.slice(1)
|
||||||
clientInfo.value = await api(`/id/auth/open/authorize?${queryString}`)
|
clientInfo.value = await api(`/pass/auth/open/authorize?${queryString}`)
|
||||||
checkIfNewApp()
|
checkIfNewApp()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
message.error(err instanceof Error ? err.message : String(err))
|
message.error(err instanceof Error ? err.message : String(err))
|
||||||
@@ -56,7 +56,7 @@ async function handleAuthorize(authorize = true) {
|
|||||||
isAuthorizing.value = true
|
isAuthorizing.value = true
|
||||||
try {
|
try {
|
||||||
const data = await api<{ redirectUri?: string }>(
|
const data = await api<{ redirectUri?: string }>(
|
||||||
"/id/auth/open/authorize",
|
"/pass/auth/open/authorize",
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ definePageMeta({
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const redirectUrl = `${apiBase}/id/auth/callback/${provider}${window.location.search}`
|
const redirectUrl = `${apiBase}/pass/auth/callback/${provider}${window.location.search}`
|
||||||
window.location.href = redirectUrl
|
window.location.href = redirectUrl
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ async function handleCreateAccount() {
|
|||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await api("/id/accounts", {
|
await api("/pass/accounts", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: {
|
body: {
|
||||||
name: formModel.name,
|
name: formModel.name,
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ async function handleFindAccount() {
|
|||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
challenge.value = await api("/id/auth/challenge", {
|
challenge.value = await api("/pass/auth/challenge", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: {
|
body: {
|
||||||
platform: 1,
|
platform: 1,
|
||||||
@@ -78,7 +78,7 @@ async function getFactors() {
|
|||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
try {
|
try {
|
||||||
const availableFactors = await api<SnAuthFactor[]>(
|
const availableFactors = await api<SnAuthFactor[]>(
|
||||||
`/id/auth/challenge/${challenge.value.id}/factors`
|
`/pass/auth/challenge/${challenge.value.id}/factors`
|
||||||
)
|
)
|
||||||
factors.value = availableFactors.filter(
|
factors.value = availableFactors.filter(
|
||||||
(f: SnAuthFactor) => !challenge.value!.blacklistFactors.includes(f.id)
|
(f: SnAuthFactor) => !challenge.value!.blacklistFactors.includes(f.id)
|
||||||
@@ -105,7 +105,7 @@ async function requestVerificationCode() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await api(
|
await api(
|
||||||
`/id/auth/challenge/${challenge.value.id}/factors/${selectedFactorId.value}`,
|
`/pass/auth/challenge/${challenge.value.id}/factors/${selectedFactorId.value}`,
|
||||||
{ method: "POST" }
|
{ method: "POST" }
|
||||||
)
|
)
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
@@ -150,7 +150,7 @@ async function handleVerifyFactor() {
|
|||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
challenge.value = await api(`/id/auth/challenge/${challenge.value.id}`, {
|
challenge.value = await api(`/pass/auth/challenge/${challenge.value.id}`, {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
body: {
|
body: {
|
||||||
factor_id: selectedFactorId.value,
|
factor_id: selectedFactorId.value,
|
||||||
@@ -181,7 +181,7 @@ async function exchangeToken() {
|
|||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
try {
|
try {
|
||||||
// The token endpoint gives the Set-Cookie header
|
// The token endpoint gives the Set-Cookie header
|
||||||
await api<{ token: string }>("/id/auth/token", {
|
await api<{ token: string }>("/pass/auth/token", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: {
|
body: {
|
||||||
grant_type: "authorization_code",
|
grant_type: "authorization_code",
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ const api = useSolarNetwork()
|
|||||||
async function fetchOrder() {
|
async function fetchOrder() {
|
||||||
try {
|
try {
|
||||||
const resp = await api<SnWalletOrder>(
|
const resp = await api<SnWalletOrder>(
|
||||||
`/id/orders/${encodeURIComponent(orderId)}`
|
`/pass/orders/${encodeURIComponent(orderId)}`
|
||||||
)
|
)
|
||||||
order.value = resp
|
order.value = resp
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
@@ -104,7 +104,7 @@ async function pay() {
|
|||||||
if (submitting.value) return
|
if (submitting.value) return
|
||||||
submitting.value = true
|
submitting.value = true
|
||||||
try {
|
try {
|
||||||
await api(`/id/orders/${encodeURIComponent(orderId)}/pay`, {
|
await api(`/pass/orders/${encodeURIComponent(orderId)}/pay`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ pin_code: pinCode.value })
|
body: JSON.stringify({ pin_code: pinCode.value })
|
||||||
@@ -123,4 +123,4 @@ definePageMeta({
|
|||||||
middleware: ["auth"],
|
middleware: ["auth"],
|
||||||
title: "Solarpay"
|
title: "Solarpay"
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ const apiBaseServer = useSolarNetworkUrl()
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const { data, error } = await useFetch<SnRealm>(
|
const { data, error } = await useFetch<SnRealm>(
|
||||||
`${apiBaseServer}/id/realms/${route.params.slug}`,
|
`${apiBaseServer}/pass/realms/${route.params.slug}`,
|
||||||
{ server: true }
|
{ server: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -474,7 +474,7 @@ async function checkMembership() {
|
|||||||
|
|
||||||
checkingMembership.value = true
|
checkingMembership.value = true
|
||||||
try {
|
try {
|
||||||
await api(`/id/realms/${realm.value.slug}/members/me`, {
|
await api(`/pass/realms/${realm.value.slug}/members/me`, {
|
||||||
method: "GET"
|
method: "GET"
|
||||||
})
|
})
|
||||||
isMember.value = true
|
isMember.value = true
|
||||||
@@ -492,7 +492,7 @@ async function handleJoin() {
|
|||||||
|
|
||||||
isJoining.value = true
|
isJoining.value = true
|
||||||
try {
|
try {
|
||||||
await api(`/id/realms/${realm.value.slug}/members/me`, {
|
await api(`/pass/realms/${realm.value.slug}/members/me`, {
|
||||||
method: "POST"
|
method: "POST"
|
||||||
})
|
})
|
||||||
message.success(`Successfully joined ${realm.value.name}!`)
|
message.success(`Successfully joined ${realm.value.name}!`)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ async function fetchSpell() {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const resp = await api<SnSpell>(
|
const resp = await api<SnSpell>(
|
||||||
`/id/spells/${encodeURIComponent(spellWord)}`
|
`/pass/spells/${encodeURIComponent(spellWord)}`
|
||||||
)
|
)
|
||||||
spell.value = resp
|
spell.value = resp
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
@@ -58,7 +58,7 @@ async function fetchSpell() {
|
|||||||
async function applySpell() {
|
async function applySpell() {
|
||||||
submitting.value = true
|
submitting.value = true
|
||||||
try {
|
try {
|
||||||
await api(`/id/spells/${encodeURIComponent(spellWord)}/apply`, {
|
await api(`/pass/spells/${encodeURIComponent(spellWord)}/apply`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: newPassword.value
|
body: newPassword.value
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export const useUserStore = defineStore("user", () => {
|
|||||||
error.value = null
|
error.value = null
|
||||||
const api = useSolarNetwork()
|
const api = useSolarNetwork()
|
||||||
try {
|
try {
|
||||||
const response = await api<SnAccount>("/id/accounts/me")
|
const response = await api<SnAccount>("/pass/accounts/me")
|
||||||
user.value = response
|
user.value = response
|
||||||
console.log(`[UserStore] Logged in as @${user.value.name}`)
|
console.log(`[UserStore] Logged in as @${user.value.name}`)
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
|
|||||||
Reference in New Issue
Block a user