mirror of
https://github.com/mgerb/classic-wow-forums
synced 2026-01-11 17:42:48 +00:00
client - support for admin/mod users
This commit is contained in:
@@ -151,6 +151,11 @@ const avatarList: AvatarModel[] = [
|
||||
title: 'undead_m',
|
||||
imageSrc: require('../assets/avatars/Undead_male.gif'),
|
||||
},
|
||||
{
|
||||
raceId: 0,
|
||||
title: 'ordinn',
|
||||
imageSrc: require('../assets/avatars/Ordinn.gif'),
|
||||
},
|
||||
];
|
||||
|
||||
export const CharacterService = {
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { orderBy } from 'lodash';
|
||||
import axios from '../axios/axios';
|
||||
import { ThreadModel } from '../model';
|
||||
|
||||
const getCategoryThreads = async (category_id: string): Promise<ThreadModel[]> => {
|
||||
try {
|
||||
const res = await axios.get(`/api/thread?category_id=${category_id}`);
|
||||
return orderBy(res.data.data as ThreadModel[], (thread: ThreadModel) => {
|
||||
return -(new Date(thread.updated_at));
|
||||
});
|
||||
return res.data.data;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
@@ -6,12 +6,13 @@ import { CharacterService } from './character.service';
|
||||
|
||||
// fetch user and store in local storage
|
||||
const authorize = async (code: string): Promise<void> => {
|
||||
try {
|
||||
const res = await axios.post('/api/user/authorize', { code });
|
||||
userStore.setUser(res.data.data);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
const res = await axios.post('/api/user/authorize', { code });
|
||||
userStore.setUser(res.data.data);
|
||||
};
|
||||
|
||||
const login = async (username: string, password: string): Promise<any> => {
|
||||
const res = await axios.post('/api/user/login', { username, password });
|
||||
userStore.setUser(res.data.data);
|
||||
};
|
||||
|
||||
const getCharacters = async (): Promise<any> => {
|
||||
@@ -53,6 +54,7 @@ const saveCharacter = async (character: any): Promise<any> => {
|
||||
|
||||
export const UserService = {
|
||||
authorize,
|
||||
saveCharacter,
|
||||
getCharacters,
|
||||
login,
|
||||
saveCharacter,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user