Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused logout #140

Merged
merged 3 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion canopeum_backend/canopeum_backend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
path("admin/", admin.site.urls),
# Auth
path("auth/login/", views.LoginAPIView.as_view(), name="login"),
path("auth/logout/", views.LogoutAPIView.as_view(), name="logout"),
path("auth/register/", views.RegisterAPIView.as_view(), name="register"),
# Post
path("social/posts/", views.PostListAPIView.as_view(), name="post-list"),
Expand Down
7 changes: 0 additions & 7 deletions canopeum_backend/canopeum_backend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,6 @@ def post(self, request):
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)


class LogoutAPIView(APIView):
@extend_schema(responses=status.HTTP_200_OK, operation_id="authentication_logout")
def post(self, request):
request.user.auth_token.delete()
return Response(status=status.HTTP_200_OK)


class TreeSpeciesAPIView(APIView):
@extend_schema(responses=TreeTypeSerializer(many=True), operation_id="tree_species")
def get(self, request):
Expand Down
34 changes: 0 additions & 34 deletions canopeum_frontend/canopeum-mockoon.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,40 +269,6 @@
],
"responseMode": null
},
{
"uuid": "6ad66afe-e470-4c14-b22b-c782220e851d",
"type": "http",
"documentation": "",
"method": "post",
"endpoint": "auth/logout",
"responses": [
{
"uuid": "30951aaa-f289-4555-abcf-728fac4895e1",
"body": "{}",
"latency": 0,
"statusCode": 200,
"label": "",
"headers": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"bodyType": "INLINE",
"filePath": "",
"databucketID": "",
"sendFileAsBody": false,
"rules": [],
"rulesOperator": "OR",
"disableTemplating": false,
"fallbackTo404": false,
"default": true,
"crudKey": "id",
"callbacks": []
}
],
"responseMode": null
},
{
"uuid": "c2e02ae6-7616-4de1-9ea2-358651b10223",
"type": "http",
Expand Down
43 changes: 0 additions & 43 deletions canopeum_frontend/src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1037,49 +1037,6 @@ export class AuthenticationClient {
return Promise.resolve<UserToken>(null as any);
}

logout(): Promise<{ [key: string]: any; }> {
let url_ = this.baseUrl + "/auth/logout/";
url_ = url_.replace(/[?&]$/, "");

let options_: RequestInit = {
method: "POST",
headers: {
"Accept": "application/json"
}
};

return this.http.fetch(url_, options_).then((_response: Response) => {
return this.processLogout(_response);
});
}

protected processLogout(response: Response): Promise<{ [key: string]: any; }> {
const status = response.status;
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
if (status === 200) {
return response.text().then((_responseText) => {
let result200: any = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
if (resultData200) {
result200 = {} as any;
for (let key in resultData200) {
if (resultData200.hasOwnProperty(key))
(<any>result200)![key] = resultData200[key] !== undefined ? resultData200[key] : <any>null;
}
}
else {
result200 = <any>null;
}
return result200;
});
} else if (status !== 200 && status !== 204) {
return response.text().then((_responseText) => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
});
}
return Promise.resolve<{ [key: string]: any; }>(null as any);
}

register(body: RegisterUser): Promise<UserToken> {
let url_ = this.baseUrl + "/auth/register/";
url_ = url_.replace(/[?&]$/, "");
Expand Down
Loading