diff options
Diffstat (limited to 'code')
| -rw-r--r-- | code/api/src/Endpoints/Internal/Account/LoginPayload.cs | 6 | ||||
| -rw-r--r-- | code/api/src/Endpoints/V1/ApiTokens/DeleteTokenRoute.cs | 2 | ||||
| -rw-r--r-- | code/api/src/Endpoints/V1/ApiTokens/GetTokensRoute.cs | 2 | ||||
| -rw-r--r-- | code/app/src/lib/api/_fetch.ts | 20 | ||||
| -rw-r--r-- | code/app/src/lib/api/account/models/LoginPayload.ts | 5 | ||||
| -rw-r--r-- | code/app/src/lib/api/account/models/UpdateProfilePayload.ts | 4 | ||||
| -rw-r--r-- | code/app/src/lib/services/settings-service.ts | 7 | ||||
| -rw-r--r-- | code/app/src/lib/session.ts | 2 | ||||
| -rw-r--r-- | code/app/src/lib/swr.ts | 6 |
9 files changed, 18 insertions, 36 deletions
diff --git a/code/api/src/Endpoints/Internal/Account/LoginPayload.cs b/code/api/src/Endpoints/Internal/Account/LoginPayload.cs deleted file mode 100644 index a5670c6..0000000 --- a/code/api/src/Endpoints/Internal/Account/LoginPayload.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace IOL.GreatOffice.Api.Endpoints.Internal.Account; - -public class LoginPayload -{ - -}
\ No newline at end of file diff --git a/code/api/src/Endpoints/V1/ApiTokens/DeleteTokenRoute.cs b/code/api/src/Endpoints/V1/ApiTokens/DeleteTokenRoute.cs index 116a814..ee19e40 100644 --- a/code/api/src/Endpoints/V1/ApiTokens/DeleteTokenRoute.cs +++ b/code/api/src/Endpoints/V1/ApiTokens/DeleteTokenRoute.cs @@ -17,8 +17,6 @@ public class DeleteTokenRoute : RouteBaseSync.WithRequest<Guid>.WithActionResult /// <returns>Nothing</returns> [ApiVersion(ApiSpecV1.VERSION_STRING)] [HttpDelete("~/v{version:apiVersion}/api-tokens/delete")] - [ProducesResponseType(200)] - [ProducesResponseType(404)] public override ActionResult Handle(Guid id) { var token = _database.AccessTokens.SingleOrDefault(c => c.Id == id); if (token == default) { diff --git a/code/api/src/Endpoints/V1/ApiTokens/GetTokensRoute.cs b/code/api/src/Endpoints/V1/ApiTokens/GetTokensRoute.cs index 19790e4..90f4d71 100644 --- a/code/api/src/Endpoints/V1/ApiTokens/GetTokensRoute.cs +++ b/code/api/src/Endpoints/V1/ApiTokens/GetTokensRoute.cs @@ -14,8 +14,6 @@ public class GetTokensRoute : RouteBaseSync.WithoutRequest.WithResult<ActionResu /// <returns>A list of tokens</returns> [ApiVersion(ApiSpecV1.VERSION_STRING)] [HttpGet("~/v{version:apiVersion}/api-tokens")] - [ProducesResponseType(200, Type = typeof(List<ApiAccessToken.ApiAccessTokenDto>))] - [ProducesResponseType(204)] public override ActionResult<List<ApiAccessToken.ApiAccessTokenDto>> Handle() { return Ok(_database.AccessTokens.Where(c => c.User.Id == LoggedInUser.Id).Select(c => c.AsDto)); } diff --git a/code/app/src/lib/api/_fetch.ts b/code/app/src/lib/api/_fetch.ts index 62cdf84..21df208 100644 --- a/code/app/src/lib/api/_fetch.ts +++ b/code/app/src/lib/api/_fetch.ts @@ -1,28 +1,28 @@ -import {Temporal} from "temporal-polyfill"; -import {clear_session_data} from "$lib/session"; -import {redirect} from "@sveltejs/kit"; -import {browser} from "$app/environment"; -import {goto} from "$app/navigation"; -import {SignInPageMessage, signInPageMessageQueryKey} from "$routes/(main)/(public)/sign-in"; -import {log_error} from "$lib/logger"; +import { Temporal } from "temporal-polyfill"; +import { clear_session_data } from "$lib/session"; +import { redirect } from "@sveltejs/kit"; +import { browser } from "$app/environment"; +import { goto } from "$app/navigation"; +import { SignInPageMessage, signInPageMessageQueryKey } from "$routes/(main)/(public)/sign-in"; +import { log_error } from "$lib/logger"; export async function http_post_async(url: string, body?: object | string, timeout = -1, skip_401_check = false, abort_signal?: AbortSignal): Promise<Response> { const init = make_request_init("post", body, abort_signal); - const response = await internal_fetch_async({url, init, timeout}); + const response = await internal_fetch_async({ url, init, timeout }); if (!skip_401_check && await redirect_if_401_async(response)) throw new Error("Server returned 401"); return response; } export async function http_get_async(url: string, timeout = -1, skip_401_check = false, abort_signal?: AbortSignal): Promise<Response> { const init = make_request_init("get", undefined, abort_signal); - const response = await internal_fetch_async({url, init, timeout}); + const response = await internal_fetch_async({ url, init, timeout }); if (!skip_401_check && await redirect_if_401_async(response)) throw new Error("Server returned 401"); return response; } export async function http_delete_async(url: string, body?: object | string, timeout = -1, skip_401_check = false, abort_signal?: AbortSignal): Promise<Response> { const init = make_request_init("delete", body, abort_signal); - const response = await internal_fetch_async({url, init, timeout}); + const response = await internal_fetch_async({ url, init, timeout }); if (!skip_401_check && await redirect_if_401_async(response)) throw new Error("Server returned 401"); return response; } diff --git a/code/app/src/lib/api/account/models/LoginPayload.ts b/code/app/src/lib/api/account/models/LoginPayload.ts deleted file mode 100644 index beb96cf..0000000 --- a/code/app/src/lib/api/account/models/LoginPayload.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface LoginPayload { - username: string, - password: string, - persist: boolean -} diff --git a/code/app/src/lib/api/account/models/UpdateProfilePayload.ts b/code/app/src/lib/api/account/models/UpdateProfilePayload.ts deleted file mode 100644 index d2983ff..0000000 --- a/code/app/src/lib/api/account/models/UpdateProfilePayload.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface UpdateProfilePayload { - username?: string, - password?: string, -} diff --git a/code/app/src/lib/services/settings-service.ts b/code/app/src/lib/services/settings-service.ts index e69de29..6b801ac 100644 --- a/code/app/src/lib/services/settings-service.ts +++ b/code/app/src/lib/services/settings-service.ts @@ -0,0 +1,7 @@ +import type { ISettingsService } from "./abstractions/ISettingsService"; + +export class SettingsService implements ISettingsService { + get_user_settings(): Promise<void> { + throw new Error("Method not implemented."); + } +}
\ No newline at end of file diff --git a/code/app/src/lib/session.ts b/code/app/src/lib/session.ts index 48dcc50..317bf59 100644 --- a/code/app/src/lib/session.ts +++ b/code/app/src/lib/session.ts @@ -33,7 +33,7 @@ async function call_api(): Promise<boolean> { try { const response = await http_account.get_profile_async(true); if (response.ok) { - const userData = await response.data; + const userData = await response.json(); if (is_guid(userData.id) && userData.username) { const session = { profile: userData, diff --git a/code/app/src/lib/swr.ts b/code/app/src/lib/swr.ts deleted file mode 100644 index 39c8665..0000000 --- a/code/app/src/lib/swr.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { createDefaultSWR } from "sswr"; -import { http_get_async } from "./api/_fetch"; - -export const swr = createDefaultSWR({ - fetcher: (key: string) => http_get_async(key), -}); |
