mirror of
https://github.com/ramvignesh-b/pi-ku.git
synced 2026-05-04 19:10:52 +00:00
refactor: centralize API endpoints and token refresh logic
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
export const endpoints = {
|
||||
LOGIN: "/api/auth/login/",
|
||||
REGISTER: "/api/auth/register/",
|
||||
VERIFY_EMAIL: "/api/auth/verify-email/",
|
||||
ACTIVATE: "/api/auth/activate/:uidb64/:token/",
|
||||
ME: "/api/auth/me/",
|
||||
REFRESH: "/api/auth/refresh/",
|
||||
LOGOUT: "/api/auth/logout/",
|
||||
};
|
||||
|
||||
// simple utility to handle path params
|
||||
export const replacePathParams = (
|
||||
url: string,
|
||||
params: Record<string, string>,
|
||||
): string => {
|
||||
let result = url;
|
||||
Object.entries(params).forEach(([key, value]) => {
|
||||
result = result.replace(`:${key}`, value);
|
||||
});
|
||||
return result;
|
||||
};
|
||||
Reference in New Issue
Block a user