feat: Implement admin user and pending course management, instructor course listing, and a dedicated admin service.
All checks were successful
Build and Deploy Frontend Management to Dev Server / Build Frontend Management Docker Image (push) Successful in 42s
Build and Deploy Frontend Management to Dev Server / Deploy E-learning Frontend Management to Dev Server (push) Successful in 4s
Build and Deploy Frontend Management to Dev Server / Notify Deployment Status (push) Successful in 1s

This commit is contained in:
Missez 2026-02-24 14:43:06 +07:00
parent 5ad7184e6c
commit 9dc8636d31
4 changed files with 212 additions and 46 deletions

View file

@ -320,7 +320,25 @@ const getAuthToken = (): string => {
return tokenCookie.value || '';
};
// Role interface
export interface RoleResponse {
id: number;
code: string;
}
export const adminService = {
async getRoles(): Promise<RoleResponse[]> {
const config = useRuntimeConfig();
const token = getAuthToken();
const response = await $fetch<{ roles: RoleResponse[] }>('/api/user/roles', {
baseURL: config.public.apiBaseUrl as string,
headers: {
Authorization: `Bearer ${token}`
}
});
return response.roles;
},
async getUsers(): Promise<AdminUserResponse[]> {
const config = useRuntimeConfig();
const token = getAuthToken();