Skip to content

Commit

Permalink
Remove unused logout (#140)
Browse files Browse the repository at this point in the history
* Remove unused logout

* Linting autofixes
  • Loading branch information
Samuel-Therrien-Beslogic authored May 15, 2024
1 parent 942c00e commit c24e122
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 85 deletions.
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 @@ -164,13 +164,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

0 comments on commit c24e122

Please sign in to comment.