[+] Export maimai userdata

This commit is contained in:
Clansty
2024-08-01 06:56:31 +08:00
parent b32b0e970c
commit 7c4f887ef4
7 changed files with 76 additions and 51 deletions

View File

@@ -141,6 +141,7 @@ export const EN_REF_SETTINGS = {
'settings.profile.bio': 'Bio',
'settings.profile.unset': 'Unset',
'settings.profile.unchanged': 'Unchanged',
'settings.export': 'Export Player Data',
}
export const EN_REF_USERBOX = {

View File

@@ -150,6 +150,7 @@ const zhSettings: typeof EN_REF_SETTINGS = {
'settings.profile.bio': '简介',
'settings.profile.unset': '未设置',
'settings.profile.unchanged': '未更改',
'settings.export': '导出玩家数据',
}
export const ZH = { ...zhUser, ...zhWelcome, ...zhGeneral,

View File

@@ -46,7 +46,7 @@ export function fetchWithParams(input: URL | RequestInfo, init?: RequestInitWith
const cache: { [index: string]: any } = {}
export async function post(endpoint: string, params: any, init?: RequestInitWithParams): Promise<any> {
export async function post(endpoint: string, params: Record<string, any> = {}, init?: RequestInitWithParams): Promise<any> {
// Add token if exists
const token = localStorage.getItem('token')
if (token && !('token' in params)) params = { ...(params ?? {}), token }
@@ -301,6 +301,8 @@ export const GAME = {
post(`/api/v2/game/${game}/ranking`, { }),
changeName: (game: GameName, newName: string): Promise<{ newName: string }> =>
post(`/api/v2/game/${game}/change-name`, { newName }),
export: (game: GameName): Promise<Record<string, any>> =>
post(`/api/v2/game/${game}/export`),
}
export const DATA = {