mirror of
https://github.com/Xevion/linkpulse.git
synced 2026-01-31 08:24:45 -06:00
remove now broken/unnecessary TARGET route prefix
This commit is contained in:
@@ -8,10 +8,6 @@ import { useUserStore } from "@/lib/state";
|
|||||||
// If any protected API call suddenly fails with a 401 status code, the user store is reset, a logout message is displayed, and the user is redirected to the login page.
|
// If any protected API call suddenly fails with a 401 status code, the user store is reset, a logout message is displayed, and the user is redirected to the login page.
|
||||||
// All redirects to the login page will carry a masked URL parameter that can be used to redirect the user back to the page they were on after logging in.
|
// All redirects to the login page will carry a masked URL parameter that can be used to redirect the user back to the page they were on after logging in.
|
||||||
|
|
||||||
const TARGET = !import.meta.env.DEV
|
|
||||||
? `http://${import.meta.env.VITE_BACKEND_TARGET}`
|
|
||||||
: "";
|
|
||||||
|
|
||||||
type ErrorResponse = {
|
type ErrorResponse = {
|
||||||
detail: string;
|
detail: string;
|
||||||
};
|
};
|
||||||
@@ -31,7 +27,7 @@ type SessionResponse = {
|
|||||||
export const getSession = async (): Promise<
|
export const getSession = async (): Promise<
|
||||||
Result<SessionResponse, ErrorResponse>
|
Result<SessionResponse, ErrorResponse>
|
||||||
> => {
|
> => {
|
||||||
const response = await fetch(TARGET + "/api/session");
|
const response = await fetch("/api/session");
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const user = await response.json();
|
const user = await response.json();
|
||||||
useUserStore.getState().setUser(user);
|
useUserStore.getState().setUser(user);
|
||||||
@@ -62,7 +58,7 @@ export const login = async (
|
|||||||
email: string,
|
email: string,
|
||||||
password: string,
|
password: string,
|
||||||
): Promise<Result<LoginResponse, ErrorResponse>> => {
|
): Promise<Result<LoginResponse, ErrorResponse>> => {
|
||||||
const response = await fetch(TARGET + "/api/login", {
|
const response = await fetch("/api/login", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|||||||
Reference in New Issue
Block a user