mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-03-13 13:30:53 +08:00
feat: increase support for multiple time zones
This commit is contained in:
14
apps/backend-mock/api/user/setTimezone.ts
Normal file
14
apps/backend-mock/api/user/setTimezone.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { eventHandler, readBody } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
import { setTimezone } from '~/utils/timezone-utils';
|
||||
|
||||
export default eventHandler(async (event) => {
|
||||
const userinfo = verifyAccessToken(event);
|
||||
if (!userinfo) {
|
||||
return unAuthorizedResponse(event);
|
||||
}
|
||||
const { timezone } = await readBody(event);
|
||||
setTimezone(timezone);
|
||||
return useResponseSuccess();
|
||||
});
|
||||
12
apps/backend-mock/api/user/timezone.ts
Normal file
12
apps/backend-mock/api/user/timezone.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { eventHandler } from 'h3';
|
||||
import { verifyAccessToken } from '~/utils/jwt-utils';
|
||||
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';
|
||||
import { getTimezone } from '~/utils/timezone-utils';
|
||||
|
||||
export default eventHandler((event) => {
|
||||
const userinfo = verifyAccessToken(event);
|
||||
if (!userinfo) {
|
||||
return unAuthorizedResponse(event);
|
||||
}
|
||||
return useResponseSuccess(getTimezone());
|
||||
});
|
||||
Reference in New Issue
Block a user