diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/config/AuthTokenFilter.java b/blog-backend/src/main/java/cn/hamster3/application/blog/config/AuthenticationFilter.java similarity index 58% rename from blog-backend/src/main/java/cn/hamster3/application/blog/config/AuthTokenFilter.java rename to blog-backend/src/main/java/cn/hamster3/application/blog/config/AuthenticationFilter.java index 7e1ea07..9d529ba 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/config/AuthTokenFilter.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/config/AuthenticationFilter.java @@ -1,17 +1,15 @@ package cn.hamster3.application.blog.config; -import jakarta.annotation.Resource; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; -import org.springframework.cache.Cache; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Component; import org.springframework.web.filter.OncePerRequestFilter; @@ -19,30 +17,23 @@ import java.io.IOException; @Slf4j @Component -public class AuthTokenFilter extends OncePerRequestFilter { - @Resource(name = "userCache") - private Cache userCache; - - public AuthTokenFilter() { +public class AuthenticationFilter extends OncePerRequestFilter { + public AuthenticationFilter() { } @Override protected void doFilterInternal(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull FilterChain filterChain) throws ServletException, IOException { - String token = request.getHeader("token"); - log.info("request token: {}", token); - if (token == null || token.isBlank()) { + HttpSession session = request.getSession(false); + if (session == null) { filterChain.doFilter(request, response); return; } - UserDetails user = userCache.get(token, UserDetails.class); - if (user == null) { + Authentication authentication = (Authentication) session.getAttribute("authenticate"); + if (authentication == null) { filterChain.doFilter(request, response); return; } SecurityContext context = SecurityContextHolder.getContext(); - UsernamePasswordAuthenticationToken authentication = UsernamePasswordAuthenticationToken.authenticated( - user, "", user.getAuthorities() - ); context.setAuthentication(authentication); filterChain.doFilter(request, response); } diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/config/WebConfig.java b/blog-backend/src/main/java/cn/hamster3/application/blog/config/WebConfig.java index 7ec8fd9..7f9ac11 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/config/WebConfig.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/config/WebConfig.java @@ -1,15 +1,12 @@ package cn.hamster3.application.blog.config; import jakarta.annotation.Resource; -import org.springframework.cache.Cache; -import org.springframework.cache.concurrent.ConcurrentMapCache; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.ProviderManager; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.cache.SpringCacheBasedUserCache; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; @@ -18,11 +15,6 @@ public class WebConfig { @Resource private UserDetailsService userDetailsService; - @Bean(name = "userCache") - public Cache getUserCache() { - return new ConcurrentMapCache("user-cache"); - } - @Bean public PasswordEncoder getPasswordEncoder() { return new BCryptPasswordEncoder(5); @@ -33,7 +25,6 @@ public class WebConfig { DaoAuthenticationProvider provider = new DaoAuthenticationProvider(); provider.setPasswordEncoder(getPasswordEncoder()); provider.setUserDetailsService(userDetailsService); - provider.setUserCache(new SpringCacheBasedUserCache(new ConcurrentMapCache("user-cache"))); return new ProviderManager(provider); } diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/config/security/DevSecurityConfig.java b/blog-backend/src/main/java/cn/hamster3/application/blog/config/security/DevSecurityConfig.java index a382ce3..110d93d 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/config/security/DevSecurityConfig.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/config/security/DevSecurityConfig.java @@ -18,7 +18,6 @@ public class DevSecurityConfig { .anyRequest().permitAll()) .cors().and() .csrf().disable() - .formLogin().and() .httpBasic().and() .build(); } @@ -32,6 +31,7 @@ public class DevSecurityConfig { .allowedOriginPatterns("*") .allowedMethods("*") .allowedHeaders("*") + .exposedHeaders("*") .allowCredentials(true) .maxAge(3600); } diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/controller/SettingController.java b/blog-backend/src/main/java/cn/hamster3/application/blog/controller/SettingController.java index fd64585..73a617c 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/controller/SettingController.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/controller/SettingController.java @@ -4,12 +4,10 @@ import cn.hamster3.application.blog.service.ISettingService; import cn.hamster3.application.blog.vo.PageableVO; import cn.hamster3.application.blog.vo.ResponseVO; import cn.hamster3.application.blog.vo.setting.SettingInfoResponseVO; -import cn.hamster3.application.blog.vo.setting.SettingUpdateRequireVO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; -import jakarta.validation.Valid; import org.springframework.data.domain.PageRequest; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; @@ -27,7 +25,7 @@ public class SettingController { return settingService.getSettingInfo(id); } - @GetMapping("/{id}/content/") + @GetMapping(value = "/{id}/content/") @Operation(summary = "获取网站设置") public ResponseVO getSettingContent(@Parameter(description = "设置ID") @PathVariable String id) { return settingService.getSettingContent(id); @@ -42,13 +40,13 @@ public class SettingController { return settingService.getSettingInfoList(PageRequest.of(page, Math.max(size, 100))); } - @PutMapping("/{id}/") + @PutMapping(value = "/{id}/", consumes = MediaType.TEXT_PLAIN_VALUE) @Operation(summary = "更改网站设置") public ResponseVO updateSetting( @Parameter(description = "设置ID") @PathVariable String id, - @RequestBody @Valid SettingUpdateRequireVO requireVO + @Parameter(description = "设置内容") @RequestBody String content ) { - return settingService.updateSetting(id, requireVO); + return settingService.updateSetting(id, content); } @DeleteMapping("/{id}/") diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/controller/UserController.java b/blog-backend/src/main/java/cn/hamster3/application/blog/controller/UserController.java index b983699..191d952 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/controller/UserController.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/controller/UserController.java @@ -13,7 +13,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid; import org.springframework.data.domain.PageRequest; import org.springframework.http.MediaType; @@ -30,8 +30,8 @@ public class UserController { @PostMapping("/login") @Operation(summary = "登录用户") - public ResponseVO loginUser(@RequestBody @Valid UserLoginRequireVO requireVO, HttpServletResponse response) { - return userService.loginUser(requireVO, response); + public ResponseVO loginUser(HttpServletRequest request, @RequestBody @Valid UserLoginRequireVO requireVO) { + return userService.loginUser(request, requireVO); } @GetMapping("/current") diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/service/ISettingService.java b/blog-backend/src/main/java/cn/hamster3/application/blog/service/ISettingService.java index fe44b11..c7ffd94 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/service/ISettingService.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/service/ISettingService.java @@ -3,7 +3,6 @@ package cn.hamster3.application.blog.service; import cn.hamster3.application.blog.vo.PageableVO; import cn.hamster3.application.blog.vo.ResponseVO; import cn.hamster3.application.blog.vo.setting.SettingInfoResponseVO; -import cn.hamster3.application.blog.vo.setting.SettingUpdateRequireVO; import org.jetbrains.annotations.NotNull; import org.springframework.data.domain.Pageable; @@ -14,7 +13,7 @@ public interface ISettingService { @NotNull ResponseVO> getSettingInfoList(@NotNull Pageable pageable); - @NotNull ResponseVO updateSetting(@NotNull String id, @NotNull SettingUpdateRequireVO requireVO); + @NotNull ResponseVO updateSetting(@NotNull String id, @NotNull String content); @NotNull ResponseVO deleteSetting(@NotNull String id); } diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/service/IUserService.java b/blog-backend/src/main/java/cn/hamster3/application/blog/service/IUserService.java index eb4293e..420dc99 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/service/IUserService.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/service/IUserService.java @@ -8,14 +8,14 @@ import cn.hamster3.application.blog.vo.user.UserCreateRequireVO; import cn.hamster3.application.blog.vo.user.UserInfoResponseVO; import cn.hamster3.application.blog.vo.user.UserLoginRequireVO; import cn.hamster3.application.blog.vo.user.UserUpdateRequireVO; -import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; import org.jetbrains.annotations.NotNull; import org.springframework.data.domain.Pageable; import java.util.UUID; public interface IUserService { - @NotNull ResponseVO loginUser(@NotNull UserLoginRequireVO requireVO, @NotNull HttpServletResponse response); + @NotNull ResponseVO loginUser(@NotNull HttpServletRequest request, @NotNull UserLoginRequireVO requireVO); @NotNull ResponseVO getCurrentUserInfo(); diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/SettingService.java b/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/SettingService.java index 222e603..dc18558 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/SettingService.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/SettingService.java @@ -8,7 +8,6 @@ import cn.hamster3.application.blog.util.BlogUtils; import cn.hamster3.application.blog.vo.PageableVO; import cn.hamster3.application.blog.vo.ResponseVO; import cn.hamster3.application.blog.vo.setting.SettingInfoResponseVO; -import cn.hamster3.application.blog.vo.setting.SettingUpdateRequireVO; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; @@ -50,7 +49,7 @@ public class SettingService implements ISettingService { } @Override - public @NotNull ResponseVO updateSetting(@NotNull String id, @NotNull SettingUpdateRequireVO requireVO) { + public @NotNull ResponseVO updateSetting(@NotNull String id, @NotNull String content) { ResponseVO check = BlogUtils.checkAdminPermission(); if (check != null) { return check; @@ -58,10 +57,10 @@ public class SettingService implements ISettingService { if (!settingRepo.existsByIdIgnoreCase(id)) { SettingEntity entity = new SettingEntity(); entity.setId(id); - entity.setContent(requireVO.getContent()); + entity.setContent(content); settingRepo.save(entity); } else { - settingRepo.updateContentByIdIgnoreCase(requireVO.getContent(), id); + settingRepo.updateContentByIdIgnoreCase(content, id); } return ResponseVO.success(); } diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/UserService.java b/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/UserService.java index 8f9bb0f..779eee1 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/UserService.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/service/impl/UserService.java @@ -20,10 +20,10 @@ import cn.hamster3.application.blog.vo.user.UserInfoResponseVO; import cn.hamster3.application.blog.vo.user.UserLoginRequireVO; import cn.hamster3.application.blog.vo.user.UserUpdateRequireVO; import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpSession; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; -import org.springframework.cache.Cache; import org.springframework.data.domain.Pageable; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -52,14 +52,11 @@ public class UserService implements IUserService { private BlogRepository blogRepo; @Resource private AttachRepository attachRepo; - - @Resource(name = "userCache") - private Cache userCache; @Resource private AuthenticationManager authenticationManager; @Override - public @NotNull ResponseVO loginUser(@NotNull UserLoginRequireVO requireVO, @NotNull HttpServletResponse response) { + public @NotNull ResponseVO loginUser(@NotNull HttpServletRequest request, @NotNull UserLoginRequireVO requireVO) { Authentication authenticate = authenticationManager.authenticate( new UsernamePasswordAuthenticationToken(requireVO.getEmail(), requireVO.getPassword()) ); @@ -67,9 +64,8 @@ public class UserService implements IUserService { if (!authenticate.isAuthenticated()) { return ResponseVO.failed("login failed."); } - UUID uuid = UUID.randomUUID(); - userCache.put(uuid.toString(), authenticate.getPrincipal()); - response.addHeader("token", uuid.toString()); + HttpSession session = request.getSession(); + session.setAttribute("authenticate", authenticate); return ResponseVO.success(); } diff --git a/blog-backend/src/main/java/cn/hamster3/application/blog/util/BlogUtils.java b/blog-backend/src/main/java/cn/hamster3/application/blog/util/BlogUtils.java index 3d3b6b7..f04e248 100644 --- a/blog-backend/src/main/java/cn/hamster3/application/blog/util/BlogUtils.java +++ b/blog-backend/src/main/java/cn/hamster3/application/blog/util/BlogUtils.java @@ -22,7 +22,6 @@ public class BlogUtils { @NotNull public static Optional getCurrentUser() { Authentication authentication = getCurrentAuthentication(); - log.info("=============================="); if (authentication == null) { log.info("current user authentication: null"); return Optional.empty(); diff --git a/blog-frontend/src/App.vue b/blog-frontend/src/App.vue index 2501eb9..6547e98 100644 --- a/blog-frontend/src/App.vue +++ b/blog-frontend/src/App.vue @@ -1,32 +1,37 @@ @@ -36,7 +41,7 @@ onMounted(() => { - {{ title }} + {{ siteSetting.title.value }} 标签 @@ -47,14 +52,14 @@ onMounted(() => {
- + 登录 - + 注册 - - 设置 + + 设置 @@ -63,6 +68,10 @@ onMounted(() => {

+ Vue3 + | + Element UI Plus + | Swagger | Editor diff --git a/blog-frontend/src/api-base/models/setting-update-require-vo.ts b/blog-frontend/src/api-base/models/setting-update-require-vo.ts deleted file mode 100644 index ce5a2c3..0000000 --- a/blog-frontend/src/api-base/models/setting-update-require-vo.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * OpenAPI definition - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * OpenAPI spec version: v0 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ -/** - * - * @export - * @interface SettingUpdateRequireVO - */ -export interface SettingUpdateRequireVO { - /** - * - * @type {string} - * @memberof SettingUpdateRequireVO - */ - content: string; -} diff --git a/blog-frontend/src/api/api.ts b/blog-frontend/src/api/api.ts new file mode 100644 index 0000000..63d7c1e --- /dev/null +++ b/blog-frontend/src/api/api.ts @@ -0,0 +1,8 @@ +import { UserControllerApiFactory, BlogControllerApiFactory, SettingControllerApiFactory, AttachControllerApiFactory } from "@/swagger" + +export const api = { + AttachController: AttachControllerApiFactory(), + UserController: UserControllerApiFactory(), + BlogController: BlogControllerApiFactory(), + SettingController: SettingControllerApiFactory() +} diff --git a/blog-frontend/src/api/global-store.ts b/blog-frontend/src/api/global-store.ts new file mode 100644 index 0000000..f3aaab1 --- /dev/null +++ b/blog-frontend/src/api/global-store.ts @@ -0,0 +1,12 @@ +import { reactive, ref } from "vue" +import type { NavigationMenu } from "@/api" +import type { UserInfoResponseVO } from "@/swagger" + +export const globalStore = { + currentUserInfo: ref({}) +} + +export const siteSetting = { + title: ref("网站标题"), + customNavigationMenu: ref>([]) +} diff --git a/blog-frontend/src/api/index.ts b/blog-frontend/src/api/index.ts new file mode 100644 index 0000000..7143ac1 --- /dev/null +++ b/blog-frontend/src/api/index.ts @@ -0,0 +1,4 @@ +export * from "./api" +export * from "./global-store" +export * from "./types" +export * from "@/swagger" \ No newline at end of file diff --git a/blog-frontend/src/api/types/index.ts b/blog-frontend/src/api/types/index.ts new file mode 100644 index 0000000..25086a9 --- /dev/null +++ b/blog-frontend/src/api/types/index.ts @@ -0,0 +1 @@ +export * from "./navigation-menu" diff --git a/blog-frontend/src/api/types/navigation-menu.ts b/blog-frontend/src/api/types/navigation-menu.ts new file mode 100644 index 0000000..98777cc --- /dev/null +++ b/blog-frontend/src/api/types/navigation-menu.ts @@ -0,0 +1,6 @@ +interface NavigationMenu { + url: string, + text: string +} + +export type { NavigationMenu } \ No newline at end of file diff --git a/blog-frontend/src/swagger/.gitignore b/blog-frontend/src/swagger/.gitignore new file mode 100644 index 0000000..205d801 --- /dev/null +++ b/blog-frontend/src/swagger/.gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist \ No newline at end of file diff --git a/blog-frontend/src/swagger/.npmignore b/blog-frontend/src/swagger/.npmignore new file mode 100644 index 0000000..999d88d --- /dev/null +++ b/blog-frontend/src/swagger/.npmignore @@ -0,0 +1 @@ +# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm \ No newline at end of file diff --git a/blog-frontend/src/swagger/.swagger-codegen-ignore b/blog-frontend/src/swagger/.swagger-codegen-ignore new file mode 100644 index 0000000..c5fa491 --- /dev/null +++ b/blog-frontend/src/swagger/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/blog-frontend/src/swagger/.swagger-codegen/VERSION b/blog-frontend/src/swagger/.swagger-codegen/VERSION new file mode 100644 index 0000000..a254f0a --- /dev/null +++ b/blog-frontend/src/swagger/.swagger-codegen/VERSION @@ -0,0 +1 @@ +3.0.41 \ No newline at end of file diff --git a/blog-frontend/src/swagger/README.md b/blog-frontend/src/swagger/README.md new file mode 100644 index 0000000..974a69f --- /dev/null +++ b/blog-frontend/src/swagger/README.md @@ -0,0 +1,45 @@ +## @ + +This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments: + +Environment +* Node.js +* Webpack +* Browserify + +Language level +* ES5 - you must have a Promises/A+ library installed +* ES6 + +Module system +* CommonJS +* ES6 module system + +It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) + +### Building + +To build and compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### Publishing + +First build the package then run ```npm publish``` + +### Consuming + +navigate to the folder of your consuming project and run one of the following commands. + +_published:_ + +``` +npm install @ --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save diff --git a/blog-frontend/src/api-base/api.ts b/blog-frontend/src/swagger/api.ts similarity index 100% rename from blog-frontend/src/api-base/api.ts rename to blog-frontend/src/swagger/api.ts diff --git a/blog-frontend/src/api-base/apis/attach-controller-api.ts b/blog-frontend/src/swagger/apis/attach-controller-api.ts similarity index 100% rename from blog-frontend/src/api-base/apis/attach-controller-api.ts rename to blog-frontend/src/swagger/apis/attach-controller-api.ts diff --git a/blog-frontend/src/api-base/apis/blog-controller-api.ts b/blog-frontend/src/swagger/apis/blog-controller-api.ts similarity index 100% rename from blog-frontend/src/api-base/apis/blog-controller-api.ts rename to blog-frontend/src/swagger/apis/blog-controller-api.ts diff --git a/blog-frontend/src/api-base/apis/setting-controller-api.ts b/blog-frontend/src/swagger/apis/setting-controller-api.ts similarity index 95% rename from blog-frontend/src/api-base/apis/setting-controller-api.ts rename to blog-frontend/src/swagger/apis/setting-controller-api.ts index fa7b02a..b00e6fa 100644 --- a/blog-frontend/src/api-base/apis/setting-controller-api.ts +++ b/blog-frontend/src/swagger/apis/setting-controller-api.ts @@ -20,7 +20,6 @@ import { ResponseVOPageableVOSettingInfoResponseVO } from '../models'; import { ResponseVOSettingInfoResponseVO } from '../models'; import { ResponseVOString } from '../models'; import { ResponseVOVoid } from '../models'; -import { SettingUpdateRequireVO } from '../models'; /** * SettingControllerApi - axios parameter creator * @export @@ -202,12 +201,12 @@ export const SettingControllerApiAxiosParamCreator = function (configuration?: C /** * * @summary 更改网站设置 - * @param {SettingUpdateRequireVO} body + * @param {string} body * @param {string} id 设置ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updateSetting: async (body: SettingUpdateRequireVO, id: string, options: AxiosRequestConfig = {}): Promise => { + updateSetting: async (body: string, id: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new RequiredError('body','Required parameter body was null or undefined when calling updateSetting.'); @@ -228,7 +227,7 @@ export const SettingControllerApiAxiosParamCreator = function (configuration?: C const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; - localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarHeaderParameter['Content-Type'] = 'text/plain'; const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { @@ -317,12 +316,12 @@ export const SettingControllerApiFp = function(configuration?: Configuration) { /** * * @summary 更改网站设置 - * @param {SettingUpdateRequireVO} body + * @param {string} body * @param {string} id 设置ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async updateSetting(body: SettingUpdateRequireVO, id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + async updateSetting(body: string, id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await SettingControllerApiAxiosParamCreator(configuration).updateSetting(body, id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; @@ -382,12 +381,12 @@ export const SettingControllerApiFactory = function (configuration?: Configurati /** * * @summary 更改网站设置 - * @param {SettingUpdateRequireVO} body + * @param {string} body * @param {string} id 设置ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async updateSetting(body: SettingUpdateRequireVO, id: string, options?: AxiosRequestConfig): Promise> { + async updateSetting(body: string, id: string, options?: AxiosRequestConfig): Promise> { return SettingControllerApiFp(configuration).updateSetting(body, id, options).then((request) => request(axios, basePath)); }, }; @@ -448,13 +447,13 @@ export class SettingControllerApi extends BaseAPI { /** * * @summary 更改网站设置 - * @param {SettingUpdateRequireVO} body + * @param {string} body * @param {string} id 设置ID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SettingControllerApi */ - public async updateSetting(body: SettingUpdateRequireVO, id: string, options?: AxiosRequestConfig) : Promise> { + public async updateSetting(body: string, id: string, options?: AxiosRequestConfig) : Promise> { return SettingControllerApiFp(this.configuration).updateSetting(body, id, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/blog-frontend/src/api-base/apis/user-controller-api.ts b/blog-frontend/src/swagger/apis/user-controller-api.ts similarity index 97% rename from blog-frontend/src/api-base/apis/user-controller-api.ts rename to blog-frontend/src/swagger/apis/user-controller-api.ts index ad9543f..c766f6d 100644 --- a/blog-frontend/src/api-base/apis/user-controller-api.ts +++ b/blog-frontend/src/swagger/apis/user-controller-api.ts @@ -30,49 +30,6 @@ import { UserUpdateRequireVO } from '../models'; */ export const UserControllerApiAxiosParamCreator = function (configuration?: Configuration) { return { - /** - * - * @summary 注册用户 - * @param {UserCreateRequireVO} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createUser: async (body: UserCreateRequireVO, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.'); - } - const localVarPath = `/api/v1/user/`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - const query = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - query.set(key, localVarQueryParameter[key]); - } - for (const key in options.params) { - query.set(key, options.params[key]); - } - localVarUrlObj.search = (new URLSearchParams(query)).toString(); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); - - return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, - options: localVarRequestOptions, - }; - }, /** * * @summary 查询用户列表 @@ -358,6 +315,49 @@ export const UserControllerApiAxiosParamCreator = function (configuration?: Conf options: localVarRequestOptions, }; }, + /** + * + * @summary 注册用户 + * @param {UserCreateRequireVO} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + register: async (body: UserCreateRequireVO, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling register.'); + } + const localVarPath = `/api/v1/user/`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, /** * * @summary 更新用户信息 @@ -416,20 +416,6 @@ export const UserControllerApiAxiosParamCreator = function (configuration?: Conf */ export const UserControllerApiFp = function(configuration?: Configuration) { return { - /** - * - * @summary 注册用户 - * @param {UserCreateRequireVO} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createUser(body: UserCreateRequireVO, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { - const localVarAxiosArgs = await UserControllerApiAxiosParamCreator(configuration).createUser(body, options); - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; - return axios.request(axiosRequestArgs); - }; - }, /** * * @summary 查询用户列表 @@ -518,6 +504,20 @@ export const UserControllerApiFp = function(configuration?: Configuration) { return axios.request(axiosRequestArgs); }; }, + /** + * + * @summary 注册用户 + * @param {UserCreateRequireVO} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async register(body: UserCreateRequireVO, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + const localVarAxiosArgs = await UserControllerApiAxiosParamCreator(configuration).register(body, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, /** * * @summary 更新用户信息 @@ -542,16 +542,6 @@ export const UserControllerApiFp = function(configuration?: Configuration) { */ export const UserControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { - /** - * - * @summary 注册用户 - * @param {UserCreateRequireVO} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createUser(body: UserCreateRequireVO, options?: AxiosRequestConfig): Promise> { - return UserControllerApiFp(configuration).createUser(body, options).then((request) => request(axios, basePath)); - }, /** * * @summary 查询用户列表 @@ -616,6 +606,16 @@ export const UserControllerApiFactory = function (configuration?: Configuration, async loginUser(body: UserLoginRequireVO, options?: AxiosRequestConfig): Promise> { return UserControllerApiFp(configuration).loginUser(body, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary 注册用户 + * @param {UserCreateRequireVO} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async register(body: UserCreateRequireVO, options?: AxiosRequestConfig): Promise> { + return UserControllerApiFp(configuration).register(body, options).then((request) => request(axios, basePath)); + }, /** * * @summary 更新用户信息 @@ -637,17 +637,6 @@ export const UserControllerApiFactory = function (configuration?: Configuration, * @extends {BaseAPI} */ export class UserControllerApi extends BaseAPI { - /** - * - * @summary 注册用户 - * @param {UserCreateRequireVO} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserControllerApi - */ - public async createUser(body: UserCreateRequireVO, options?: AxiosRequestConfig) : Promise> { - return UserControllerApiFp(this.configuration).createUser(body, options).then((request) => request(this.axios, this.basePath)); - } /** * * @summary 查询用户列表 @@ -718,6 +707,17 @@ export class UserControllerApi extends BaseAPI { public async loginUser(body: UserLoginRequireVO, options?: AxiosRequestConfig) : Promise> { return UserControllerApiFp(this.configuration).loginUser(body, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary 注册用户 + * @param {UserCreateRequireVO} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserControllerApi + */ + public async register(body: UserCreateRequireVO, options?: AxiosRequestConfig) : Promise> { + return UserControllerApiFp(this.configuration).register(body, options).then((request) => request(this.axios, this.basePath)); + } /** * * @summary 更新用户信息 diff --git a/blog-frontend/src/api-base/base.ts b/blog-frontend/src/swagger/base.ts similarity index 100% rename from blog-frontend/src/api-base/base.ts rename to blog-frontend/src/swagger/base.ts diff --git a/blog-frontend/src/api-base/configuration.ts b/blog-frontend/src/swagger/configuration.ts similarity index 100% rename from blog-frontend/src/api-base/configuration.ts rename to blog-frontend/src/swagger/configuration.ts diff --git a/blog-frontend/src/swagger/git_push.sh b/blog-frontend/src/swagger/git_push.sh new file mode 100644 index 0000000..68a0a83 --- /dev/null +++ b/blog-frontend/src/swagger/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh hugomario swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/blog-frontend/src/api-base/index.ts b/blog-frontend/src/swagger/index.ts similarity index 100% rename from blog-frontend/src/api-base/index.ts rename to blog-frontend/src/swagger/index.ts diff --git a/blog-frontend/src/api-base/models/attach-attach-idbody.ts b/blog-frontend/src/swagger/models/attach-attach-idbody.ts similarity index 100% rename from blog-frontend/src/api-base/models/attach-attach-idbody.ts rename to blog-frontend/src/swagger/models/attach-attach-idbody.ts diff --git a/blog-frontend/src/api-base/models/attach-entity.ts b/blog-frontend/src/swagger/models/attach-entity.ts similarity index 100% rename from blog-frontend/src/api-base/models/attach-entity.ts rename to blog-frontend/src/swagger/models/attach-entity.ts diff --git a/blog-frontend/src/api-base/models/attach-info-response-vo.ts b/blog-frontend/src/swagger/models/attach-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/attach-info-response-vo.ts rename to blog-frontend/src/swagger/models/attach-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/blog-attach-entity.ts b/blog-frontend/src/swagger/models/blog-attach-entity.ts similarity index 100% rename from blog-frontend/src/api-base/models/blog-attach-entity.ts rename to blog-frontend/src/swagger/models/blog-attach-entity.ts diff --git a/blog-frontend/src/api-base/models/blog-entity.ts b/blog-frontend/src/swagger/models/blog-entity.ts similarity index 100% rename from blog-frontend/src/api-base/models/blog-entity.ts rename to blog-frontend/src/swagger/models/blog-entity.ts diff --git a/blog-frontend/src/api-base/models/blog-info-response-vo.ts b/blog-frontend/src/swagger/models/blog-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/blog-info-response-vo.ts rename to blog-frontend/src/swagger/models/blog-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/blog-update-require-vo.ts b/blog-frontend/src/swagger/models/blog-update-require-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/blog-update-require-vo.ts rename to blog-frontend/src/swagger/models/blog-update-require-vo.ts diff --git a/blog-frontend/src/api-base/models/index.ts b/blog-frontend/src/swagger/models/index.ts similarity index 96% rename from blog-frontend/src/api-base/models/index.ts rename to blog-frontend/src/swagger/models/index.ts index 193a3a0..44d139e 100644 --- a/blog-frontend/src/api-base/models/index.ts +++ b/blog-frontend/src/swagger/models/index.ts @@ -21,7 +21,6 @@ export * from './response-vostring'; export * from './response-vouser-info-response-vo'; export * from './response-vovoid'; export * from './setting-info-response-vo'; -export * from './setting-update-require-vo'; export * from './user-create-require-vo'; export * from './user-entity'; export * from './user-info-response-vo'; diff --git a/blog-frontend/src/api-base/models/pageable-voattach-info-response-vo.ts b/blog-frontend/src/swagger/models/pageable-voattach-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/pageable-voattach-info-response-vo.ts rename to blog-frontend/src/swagger/models/pageable-voattach-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/pageable-voblog-info-response-vo.ts b/blog-frontend/src/swagger/models/pageable-voblog-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/pageable-voblog-info-response-vo.ts rename to blog-frontend/src/swagger/models/pageable-voblog-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/pageable-vosetting-info-response-vo.ts b/blog-frontend/src/swagger/models/pageable-vosetting-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/pageable-vosetting-info-response-vo.ts rename to blog-frontend/src/swagger/models/pageable-vosetting-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/pageable-vouser-info-response-vo.ts b/blog-frontend/src/swagger/models/pageable-vouser-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/pageable-vouser-info-response-vo.ts rename to blog-frontend/src/swagger/models/pageable-vouser-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/response-voblog-info-response-vo.ts b/blog-frontend/src/swagger/models/response-voblog-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/response-voblog-info-response-vo.ts rename to blog-frontend/src/swagger/models/response-voblog-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/response-volist-blog-info-response-vo.ts b/blog-frontend/src/swagger/models/response-volist-blog-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/response-volist-blog-info-response-vo.ts rename to blog-frontend/src/swagger/models/response-volist-blog-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/response-volong.ts b/blog-frontend/src/swagger/models/response-volong.ts similarity index 100% rename from blog-frontend/src/api-base/models/response-volong.ts rename to blog-frontend/src/swagger/models/response-volong.ts diff --git a/blog-frontend/src/api-base/models/response-vopageable-voattach-info-response-vo.ts b/blog-frontend/src/swagger/models/response-vopageable-voattach-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/response-vopageable-voattach-info-response-vo.ts rename to blog-frontend/src/swagger/models/response-vopageable-voattach-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/response-vopageable-voblog-info-response-vo.ts b/blog-frontend/src/swagger/models/response-vopageable-voblog-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/response-vopageable-voblog-info-response-vo.ts rename to blog-frontend/src/swagger/models/response-vopageable-voblog-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/response-vopageable-vosetting-info-response-vo.ts b/blog-frontend/src/swagger/models/response-vopageable-vosetting-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/response-vopageable-vosetting-info-response-vo.ts rename to blog-frontend/src/swagger/models/response-vopageable-vosetting-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/response-vopageable-vouser-info-response-vo.ts b/blog-frontend/src/swagger/models/response-vopageable-vouser-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/response-vopageable-vouser-info-response-vo.ts rename to blog-frontend/src/swagger/models/response-vopageable-vouser-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/response-vosetting-info-response-vo.ts b/blog-frontend/src/swagger/models/response-vosetting-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/response-vosetting-info-response-vo.ts rename to blog-frontend/src/swagger/models/response-vosetting-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/response-vostring.ts b/blog-frontend/src/swagger/models/response-vostring.ts similarity index 100% rename from blog-frontend/src/api-base/models/response-vostring.ts rename to blog-frontend/src/swagger/models/response-vostring.ts diff --git a/blog-frontend/src/api-base/models/response-vouser-info-response-vo.ts b/blog-frontend/src/swagger/models/response-vouser-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/response-vouser-info-response-vo.ts rename to blog-frontend/src/swagger/models/response-vouser-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/response-vovoid.ts b/blog-frontend/src/swagger/models/response-vovoid.ts similarity index 100% rename from blog-frontend/src/api-base/models/response-vovoid.ts rename to blog-frontend/src/swagger/models/response-vovoid.ts diff --git a/blog-frontend/src/api-base/models/setting-info-response-vo.ts b/blog-frontend/src/swagger/models/setting-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/setting-info-response-vo.ts rename to blog-frontend/src/swagger/models/setting-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/user-create-require-vo.ts b/blog-frontend/src/swagger/models/user-create-require-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/user-create-require-vo.ts rename to blog-frontend/src/swagger/models/user-create-require-vo.ts diff --git a/blog-frontend/src/api-base/models/user-entity.ts b/blog-frontend/src/swagger/models/user-entity.ts similarity index 100% rename from blog-frontend/src/api-base/models/user-entity.ts rename to blog-frontend/src/swagger/models/user-entity.ts diff --git a/blog-frontend/src/api-base/models/user-info-response-vo.ts b/blog-frontend/src/swagger/models/user-info-response-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/user-info-response-vo.ts rename to blog-frontend/src/swagger/models/user-info-response-vo.ts diff --git a/blog-frontend/src/api-base/models/user-login-require-vo.ts b/blog-frontend/src/swagger/models/user-login-require-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/user-login-require-vo.ts rename to blog-frontend/src/swagger/models/user-login-require-vo.ts diff --git a/blog-frontend/src/api-base/models/user-update-require-vo.ts b/blog-frontend/src/swagger/models/user-update-require-vo.ts similarity index 100% rename from blog-frontend/src/api-base/models/user-update-require-vo.ts rename to blog-frontend/src/swagger/models/user-update-require-vo.ts diff --git a/blog-frontend/src/api-base/models/v1-attach-body.ts b/blog-frontend/src/swagger/models/v1-attach-body.ts similarity index 100% rename from blog-frontend/src/api-base/models/v1-attach-body.ts rename to blog-frontend/src/swagger/models/v1-attach-body.ts diff --git a/blog-frontend/src/api-base/tsconfig.json b/blog-frontend/src/swagger/tsconfig.json similarity index 100% rename from blog-frontend/src/api-base/tsconfig.json rename to blog-frontend/src/swagger/tsconfig.json diff --git a/blog-frontend/src/utils/index.ts b/blog-frontend/src/utils/index.ts new file mode 100644 index 0000000..9f1993b --- /dev/null +++ b/blog-frontend/src/utils/index.ts @@ -0,0 +1,15 @@ +import { api, globalStore } from "@/api"; + + +export function updateCurrentUserInfo() { + api.UserController.getCurrentUserInfo({ withCredentials: true }) + .then(resp => { + let vo = resp.data + if (vo.code === 200) { + globalStore.currentUserInfo.value = vo.data || {} + console.log("current user info: ", vo.data) + } else { + console.error("ckeck current user info failed!") + } + }) +} \ No newline at end of file diff --git a/blog-frontend/src/views/LoginView.vue b/blog-frontend/src/views/LoginView.vue index e670975..762eff0 100644 --- a/blog-frontend/src/views/LoginView.vue +++ b/blog-frontend/src/views/LoginView.vue @@ -1,7 +1,7 @@ diff --git a/blog-frontend/src/views/SettingsView.vue b/blog-frontend/src/views/SettingsView.vue index 8e8347f..b3612ca 100644 --- a/blog-frontend/src/views/SettingsView.vue +++ b/blog-frontend/src/views/SettingsView.vue @@ -1,13 +1,22 @@ + + - - - \ No newline at end of file + \ No newline at end of file