handle cookie through text form, #856

This commit is contained in:
Simon
2025-01-10 17:09:11 +07:00
parent 5cc40315c4
commit d1a42c4b57
6 changed files with 143 additions and 30 deletions

View File

@@ -0,0 +1,10 @@
import APIClient from '../../functions/APIClient';
import { CookieStateType } from '../loader/loadCookie';
const deleteCookie = async (): Promise<CookieStateType> => {
return APIClient('/api/appsettings/cookie/', {
method: 'DELETE',
});
};
export default deleteCookie;

View File

@@ -1,16 +1,10 @@
import APIClient from '../../functions/APIClient';
import { CookieStateType } from '../loader/loadCookie';
export type ValidatedCookieType = {
cookie_enabled: boolean;
status: boolean;
validated: number;
validated_str: string;
cookie_validated?: boolean;
};
const updateCookie = async (): Promise<ValidatedCookieType> => {
const updateCookie = async (cookie: string): Promise<CookieStateType> => {
return APIClient('/api/appsettings/cookie/', {
method: 'POST',
method: 'PUT',
body: { cookie },
});
};

View File

@@ -0,0 +1,10 @@
import APIClient from '../../functions/APIClient';
import { CookieStateType } from '../loader/loadCookie';
const validateCookie = async (): Promise<CookieStateType> => {
return APIClient('/api/appsettings/cookie/', {
method: 'POST',
});
};
export default validateCookie;