mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
update web references to API routes since they all changed
This commit is contained in:
parent
073860156f
commit
c7774ddca3
6 changed files with 11 additions and 11 deletions
|
@ -52,7 +52,7 @@ export const GuildProvider = (props: { children: React.ReactNode }) => {
|
|||
}
|
||||
}
|
||||
|
||||
const response = await fetch(`/get-slug/${id}`);
|
||||
const response = await fetch(`/guilds/${id}/slug`);
|
||||
if (response.status !== 200) {
|
||||
return null;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ export const GuildProvider = (props: { children: React.ReactNode }) => {
|
|||
}
|
||||
|
||||
const skipCache = uncached ? '?__no_cache' : '';
|
||||
const response = await authedFetch(`/get-picker-data/${id}${skipCache}`);
|
||||
const response = await authedFetch(`/guilds/${id}${skipCache}`);
|
||||
const guild: PresentableGuild = await response.json();
|
||||
|
||||
if (response.status !== 200) {
|
||||
|
|
|
@ -161,7 +161,7 @@ export const SessionContextProvider = (props: { children: React.ReactNode }) =>
|
|||
} catch (e) {
|
||||
console.error('syncSession failed', e);
|
||||
deleteSessionKey();
|
||||
setLock(false);
|
||||
setTimeout(() => setLock(false), 1000); // Unlock after 1s to prevent loop flood
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -184,7 +184,7 @@ type ServerSession = Omit<Omit<SessionData, 'tokens'>, 'flags'>;
|
|||
const fetchSession = async (
|
||||
authedFetch: SessionContextT['authedFetch']
|
||||
): Promise<ServerSession | null> => {
|
||||
const sessionResponse = await authedFetch('/get-session');
|
||||
const sessionResponse = await authedFetch('/auth/session');
|
||||
if (sessionResponse.status !== 200) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -15,13 +15,13 @@ const Login = (props: { path: string }) => {
|
|||
// If ?r is in query, then let's render the slug page
|
||||
// If not, redirect.
|
||||
const [guildSlug, setGuildSlug] = React.useState<GuildSlug | null>(null);
|
||||
const [oauthLink, setOauthLink] = React.useState(`${apiUrl}/login-bounce`);
|
||||
const [oauthLink, setOauthLink] = React.useState(`${apiUrl}/auth/bounce`);
|
||||
|
||||
React.useEffect(() => {
|
||||
const url = new URL(window.location.href);
|
||||
const callbackHost = new URL('/', url);
|
||||
const redirectServerID = url.searchParams.get('r');
|
||||
const redirectUrl = `${apiUrl}/login-bounce?cbh=${callbackHost.href}`;
|
||||
const redirectUrl = `${apiUrl}/auth/bounce?cbh=${callbackHost.href}`;
|
||||
if (!redirectServerID) {
|
||||
if (isAuthenticated) {
|
||||
redirectTo('/servers');
|
||||
|
|
|
@ -89,7 +89,7 @@ const Editor = (props: EditorProps) => {
|
|||
categories: guild.data.categories,
|
||||
};
|
||||
|
||||
const response = await authedFetch(`/update-guild/${serverID}`, {
|
||||
const response = await authedFetch(`/guilds/${serverID}`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(updatePayload),
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@ const BotJoin = (props: { serverID: string; path: string }) => {
|
|||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
window.location.href = `${apiUrl}/bot-join${params}`;
|
||||
window.location.href = `${apiUrl}/auth/bot${params}`;
|
||||
}, [apiUrl, params]);
|
||||
|
||||
return <GenericLoadingTemplate />;
|
||||
|
|
|
@ -65,7 +65,7 @@ const Picker = (props: PickerProps) => {
|
|||
const guildSlug = session.guilds.find((guild) => guild.id === props.serverID);
|
||||
|
||||
if (!guildSlug) {
|
||||
console.error({ error: 'guold not in session, 404' });
|
||||
console.error({ error: 'guild not in session, 404' });
|
||||
return <Redirect to="/error/404" replace />;
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,8 @@ const Picker = (props: PickerProps) => {
|
|||
};
|
||||
|
||||
uncacheGuild(props.serverID);
|
||||
const response = await authedFetch(`/update-roles/${props.serverID}`, {
|
||||
method: 'PATCH',
|
||||
const response = await authedFetch(`/guilds/${props.serverID}/roles`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(updatePayload),
|
||||
});
|
||||
if (response.status === 200) {
|
||||
|
|
Loading…
Add table
Reference in a new issue