Fix issues with new user save data
This commit is contained in:
@@ -52,6 +52,7 @@ export async function handler (context: Context) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
let savedata = JSON.parse(result[0].saveData)
|
let savedata = JSON.parse(result[0].saveData)
|
||||||
|
if (!savedata.account) savedata.account = {}
|
||||||
savedata.account.id = userId
|
savedata.account.id = userId
|
||||||
savedata.account.name = result2[0].username
|
savedata.account.name = result2[0].username
|
||||||
savedata.account.session = result[0].token
|
savedata.account.session = result[0].token
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Context } from 'elysia'
|
import { Context } from 'elysia'
|
||||||
import { getDatabaseConnection, jsonResponse } from '../../../../lib/util'
|
import { getDatabaseConnection, jsonResponse } from '../../../../lib/util'
|
||||||
import { checkAuthorization } from '../../../../lib/bd/auth'
|
import { checkAuthorization } from '../../../../lib/bd/auth'
|
||||||
import { berryDashUserData, users } from '../../../../lib/tables'
|
import { berryDashUserData } from '../../../../lib/tables'
|
||||||
import { eq } from 'drizzle-orm'
|
import { eq } from 'drizzle-orm'
|
||||||
|
|
||||||
type Body = {
|
type Body = {
|
||||||
@@ -42,6 +42,7 @@ export async function handler (context: Context) {
|
|||||||
let userSaveData: any = {}
|
let userSaveData: any = {}
|
||||||
try {
|
try {
|
||||||
userSaveData = JSON.parse(atob(body.saveData))
|
userSaveData = JSON.parse(atob(body.saveData))
|
||||||
|
if (!userSaveData.account) userSaveData.account = {}
|
||||||
userSaveData.account.id = null
|
userSaveData.account.id = null
|
||||||
userSaveData.account.name = null
|
userSaveData.account.name = null
|
||||||
userSaveData.account.session = null
|
userSaveData.account.session = null
|
||||||
|
|||||||
Reference in New Issue
Block a user