Adding chtlawfirm to the api

This commit is contained in:
2025-04-10 22:43:00 +02:00
parent 72a8e7fb91
commit ef9ae99cb6
34 changed files with 1648 additions and 44 deletions

View File

@@ -6,7 +6,7 @@ import { IAuthUser, IFirm } from "../../interfaces";
export const Hub = () => {
const { data: user } = useGetIdentity<IAuthUser>();
const { data: list } = useList<IFirm>({resource: "firms/", pagination: { mode: "off" }}, )
const { data: list } = useList<IFirm>({resource: "hub/users/firms/", pagination: { mode: "off" }}, )
if (user === undefined || list === undefined) {
return <p>Loading</p>
}

View File

@@ -18,7 +18,7 @@ export const authProvider: AuthProvider = {
scope = DISCORD_SCOPES;
}
const params = new URLSearchParams(scope);
const url = `${API_URL}/auth/${providerName}/authorize?${params.toString()}`;
const url = `${API_URL}/hub/auth/${providerName}/authorize?${params.toString()}`;
const response = await fetch(url, { method: "GET", },);
const body = await response.json();
@@ -30,7 +30,7 @@ export const authProvider: AuthProvider = {
} else if (email !== undefined && password !== undefined) {
const params = new URLSearchParams({"grant_type": "password", "username": email, "password": password});
const response = await fetch(
`${API_URL}/auth/login`,
`${API_URL}/hub/auth/login`,
{
method: "POST",
body: params.toString(),
@@ -38,7 +38,7 @@ export const authProvider: AuthProvider = {
},
);
if (response.status >= 200 && response.status < 300) {
const response = await fetch(`${API_URL}/users/me`);
const response = await fetch(`${API_URL}/hub/users/me`);
const user = await response.json();
store_user(user);
@@ -49,7 +49,7 @@ export const authProvider: AuthProvider = {
return { success: false };
},
logout: async () => {
const response = await fetch(`${API_URL}/auth/logout`, { method: "POST" });
const response = await fetch(`${API_URL}/hub/auth/logout`, { method: "POST" });
if (response.status == 204 || response.status == 401) {
forget_user();
return { success: true };
@@ -72,7 +72,7 @@ export const authProvider: AuthProvider = {
return user;
}
const response = await fetch(`${API_URL}/users/me`);
const response = await fetch(`${API_URL}/hub/users/me`);
if (response.status < 200 || response.status > 299) {
return null;
}
@@ -82,7 +82,7 @@ export const authProvider: AuthProvider = {
return user_data;
},
register: async (params) => {
const response = await fetch(`${API_URL}/register`, {
const response = await fetch(`${API_URL}/hub/register`, {
method: "POST",
body: JSON.stringify(params),
headers: {
@@ -103,7 +103,7 @@ export const authProvider: AuthProvider = {
};
},
forgotPassword: async (params) => {
const response = await fetch(`${API_URL}/users/forgot-password`, {
const response = await fetch(`${API_URL}/hub/users/forgot-password`, {
method: "POST",
body: JSON.stringify(params),
headers: {
@@ -119,7 +119,7 @@ export const authProvider: AuthProvider = {
},
updatePassword: async (params) => {
if (params.token !== undefined) {
const response = await fetch(`${API_URL}/users/reset-password`, {
const response = await fetch(`${API_URL}/hub/users/reset-password`, {
method: "POST",
body: JSON.stringify({
password: params.password,