Skip to content

Commit

Permalink
Add more menu and table stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
pvyParts committed Jul 31, 2024
1 parent 57c81b9 commit 3174bd2
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 83 deletions.
5 changes: 4 additions & 1 deletion corptools/api/core/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ def get_character_menu(request):
}
_char = {
"name": _("Characters"),
"links": []
"links": [{
"name": _("Corp History"),
"link": "account/pubdata"
}]
}

if app_settings.CT_CHAR_CONTACTS_MODULE:
Expand Down
4 changes: 2 additions & 2 deletions frontend/frontend/src/Components/CharacterMenu/CharMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const CharMenu = ({ data, characterID }: CharMenuProps) => {
<Nav.Link key="Status">Status</Nav.Link>
</LinkContainer>
</Nav.Item>
<Nav.Item>
{/* <Nav.Item>
<LinkContainer to={`/audit/r_beta/${characterID}/account/pubdata`}>
<Nav.Link key="Public Data">Public Data</Nav.Link>
</LinkContainer>
</Nav.Item>
</Nav.Item> */}
{data &&
data.map((cat: any) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useParams } from "react-router-dom";
const menuRoot = document.getElementById("nav-left");

const CharMenuAsync = () => {
let { characterID } = useParams();
const { characterID } = useParams();
const { isLoading, error, data } = useQuery({
queryKey: ["Menu"],
queryFn: async () => {
Expand Down
137 changes: 58 additions & 79 deletions frontend/frontend/src/api/character.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,49 @@ import Cookies from "js-cookie";

axios.defaults.xsrfHeaderName = "X-CSRFToken";

export async function getCharacterEndpoint(endpoint: any, characterID: number) {
const { GET } = getCatApi();
const { data, error } = await GET(endpoint, {
params: {
path: { character_id: characterID },
},
});
if (error) {
console.log(error);
} else {
console.log(data);
return data;
}
}

export async function getCharacterContacts(characterID: number) {
return getCharacterEndpoint("/audit/api/account/{character_id}/contacts", characterID);
}

export async function getCharacterNotifications(characterID: number) {
return getCharacterEndpoint("/audit/api/account/{character_id}/notifications", characterID);
}

export async function getCharacterClones(characterID: number) {
return getCharacterEndpoint("/audit/api/account/{character_id}/clones", characterID);
}

export async function getCharacterRoles(characterID: number) {
return getCharacterEndpoint("/audit/api/account/{character_id}/roles", characterID);
}

export async function loadGlanceAssetData(characterID: number) {
return getCharacterEndpoint("/audit/api/account/{character_id}/glance/assets", characterID);
}

export async function loadGlanceActivityData(characterID: number) {
return getCharacterEndpoint("/audit/api/account/{character_id}/glance/activities", characterID);
}

export async function loadGlanceFactionData(characterID: number) {
return getCharacterEndpoint("/audit/api/account/{character_id}/glance/faction", characterID);
}

export async function loadCharacterStatus(character_id: number) {
const api = await axios.get(`/audit/api/account/${character_id}/status`);
console.log(`got character status from api for '${character_id}'`);
Expand Down Expand Up @@ -37,23 +80,23 @@ export async function loadPubData(character_id: number) {
return data;
}

export async function loadGlanceAssetData(character_id: number) {
const api = await axios.get(`/audit/api/account/${character_id}/glance/assets`);
console.log(`get glance/assets in api ${character_id}`);
return api.data;
}
// export async function loadGlanceAssetData(character_id: number) {
// const api = await axios.get(`/audit/api/account/${character_id}/glance/assets`);
// console.log(`get glance/assets in api ${character_id}`);
// return api.data;
// }

export async function loadGlanceActivityData(character_id: number) {
const api = await axios.get(`/audit/api/account/${character_id}/glance/activities`);
console.log(`get glance/activities in api ${character_id}`);
return api.data;
}
// export async function loadGlanceActivityData(character_id: number) {
// const api = await axios.get(`/audit/api/account/${character_id}/glance/activities`);
// console.log(`get glance/activities in api ${character_id}`);
// return api.data;
// }

export async function loadGlanceFactionData(character_id: number) {
const api = await axios.get(`/audit/api/account/${character_id}/glance/faction`);
console.log(`get glance/faction in api ${character_id}`);
return api.data;
}
// export async function loadGlanceFactionData(character_id: number) {
// const api = await axios.get(`/audit/api/account/${character_id}/glance/faction`);
// console.log(`get glance/faction in api ${character_id}`);
// return api.data;
// }

export async function postAccountRefresh(character_id: number) {
console.log(`sent account refresh ${character_id}`);
Expand Down Expand Up @@ -99,67 +142,3 @@ export async function loadWalletActivity(character_id: number) {
console.log(`get wallet activity in api ${character_id}`);
return api.data;
}

export async function getCharacterContacts(characterID: number) {
const { GET } = getCatApi();

const { data, error } = await GET("/audit/api/account/{character_id}/contacts", {
params: {
path: { character_id: characterID },
},
});
if (error) {
console.log(error);
} else {
console.log(data);
return data;
}
}

export async function getCharacterNotifications(characterID: number) {
const { GET } = getCatApi();

const { data, error } = await GET("/audit/api/account/{character_id}/notifications", {
params: {
path: { character_id: characterID },
},
});
if (error) {
console.log(error);
} else {
console.log(data);
return data;
}
}

export async function getCharacterClones(characterID: number) {
const { GET } = getCatApi();

const { data, error } = await GET("/audit/api/account/{character_id}/clones", {
params: {
path: { character_id: characterID },
},
});
if (error) {
console.log(error);
} else {
console.log(data);
return data;
}
}

export async function getCharacterRoles(characterID: number) {
const { GET } = getCatApi();

const { data, error } = await GET("/audit/api/account/{character_id}/roles", {
params: {
path: { character_id: characterID },
},
});
if (error) {
console.log(error);
} else {
console.log(data);
return data;
}
}

0 comments on commit 3174bd2

Please sign in to comment.