feat(backend): move internal endpoints to /api/internal
This commit is contained in:
parent
eac0a17473
commit
06f7019330
9 changed files with 39 additions and 27 deletions
|
@ -16,7 +16,7 @@ async function requestInternal(
|
|||
path: string,
|
||||
params: RequestParams = {},
|
||||
): Promise<Response> {
|
||||
const base = params.isInternal ? INTERNAL_API_BASE : API_BASE + "/v2";
|
||||
const base = params.isInternal ? INTERNAL_API_BASE + "/internal" : API_BASE + "/v2";
|
||||
|
||||
const url = `${base}${path}`;
|
||||
const resp = await fetch(url, {
|
||||
|
|
|
@ -43,6 +43,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|||
|
||||
const resp = await serverRequest<CallbackResponse>("POST", "/auth/discord/callback", {
|
||||
body: { code, state },
|
||||
isInternal: true,
|
||||
});
|
||||
|
||||
if (resp.has_account) {
|
||||
|
@ -89,6 +90,7 @@ export const action = async ({ request }: ActionFunctionArgs) => {
|
|||
try {
|
||||
const resp = await serverRequest<AuthResponse>("POST", "/auth/discord/register", {
|
||||
body: { username, ticket },
|
||||
isInternal: true,
|
||||
});
|
||||
|
||||
return redirect("/auth/welcome", {
|
||||
|
|
|
@ -41,7 +41,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|||
}
|
||||
}
|
||||
|
||||
const urls = await serverRequest<AuthUrls>("POST", "/auth/urls");
|
||||
const urls = await serverRequest<AuthUrls>("POST", "/auth/urls", { isInternal: true });
|
||||
|
||||
return json({
|
||||
meta: { title: t("log-in.title") },
|
||||
|
@ -57,6 +57,7 @@ export const action = async ({ request }: ActionFunctionArgs) => {
|
|||
try {
|
||||
const resp = await serverRequest<AuthResponse>("POST", "/auth/email/login", {
|
||||
body: { email, password },
|
||||
isInternal: true,
|
||||
});
|
||||
|
||||
return redirect("/", {
|
||||
|
|
|
@ -10,7 +10,7 @@ export const action: ActionFunction = async ({ request }) => {
|
|||
headers: { "Set-Cookie": writeCookie(tokenCookieName, "token", 0) },
|
||||
});
|
||||
|
||||
await fastRequest("POST", "/internal/force-log-out", { token, isInternal: true });
|
||||
await fastRequest("POST", "/auth/force-log-out", { token, isInternal: true });
|
||||
|
||||
return redirect("/", {
|
||||
status: 303,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue