-
Notifications
You must be signed in to change notification settings - Fork 421
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/main' into chore/rtk-identity-traits
# Conflicts: # frontend/common/types/requests.ts # frontend/web/components/pages/UserPage.tsx
- Loading branch information
Showing
38 changed files
with
1,316 additions
and
1,027 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Initial Mypy '# type: ignore' comments dump | ||
# https://github.com/Flagsmith/flagsmith/pull/5119 | ||
5de0b425b0ee16b16bfb0fb33b067fa314d040fb | ||
# Linting fixes for frontend | ||
# https://github.com/Flagsmith/flagsmith/pull/5123 | ||
1f7083636d3b163588fe9a8b45af289bd40b1a8d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Res } from 'common/types/responses' | ||
import { Req } from 'common/types/requests' | ||
import { service } from 'common/service' | ||
import Utils from 'common/utils/utils' | ||
import transformCorePaging from 'common/transformCorePaging' | ||
import { sortBy } from 'lodash' | ||
|
||
export const identitySegmentService = service | ||
.enhanceEndpoints({ addTagTypes: ['IdentitySegment'] }) | ||
.injectEndpoints({ | ||
endpoints: (builder) => ({ | ||
getIdentitySegments: builder.query< | ||
Res['identitySegments'], | ||
Req['getIdentitySegments'] | ||
>({ | ||
providesTags: (res) => [{ id: res?.id, type: 'IdentitySegment' }], | ||
query: ({ projectId, ...query }: Req['getIdentitySegments']) => ({ | ||
url: `/projects/${projectId}/segments/?${Utils.toParam(query)}`, | ||
}), | ||
transformResponse: ( | ||
res: Res['identitySegments'], | ||
_, | ||
req: Req['getIdentitySegments'], | ||
) => | ||
transformCorePaging(req, { | ||
...res, | ||
results: sortBy(res.results, 'name'), | ||
}), | ||
}), | ||
// END OF ENDPOINTS | ||
}), | ||
}) | ||
|
||
export async function getIdentitySegments( | ||
store: any, | ||
data: Req['getIdentitySegments'], | ||
options?: Parameters< | ||
typeof identitySegmentService.endpoints.getIdentitySegments.initiate | ||
>[1], | ||
) { | ||
return store.dispatch( | ||
identitySegmentService.endpoints.getIdentitySegments.initiate( | ||
data, | ||
options, | ||
), | ||
) | ||
} | ||
// END OF FUNCTION_EXPORTS | ||
|
||
export const { | ||
useGetIdentitySegmentsQuery, | ||
// END OF EXPORTS | ||
} = identitySegmentService | ||
|
||
/* Usage examples: | ||
const { data, isLoading } = useGetIdentitySegmentsQuery({ id: 2 }, {}) //get hook | ||
const [createIdentitySegments, { isLoading, data, isSuccess }] = useCreateIdentitySegmentsMutation() //create hook | ||
identitySegmentService.endpoints.getIdentitySegments.select({id: 2})(store.getState()) //access data from any function | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.